Results 1 to 2 of 2

Thread: How do I search for files which contain a specific text string?

  1. #1
    Join Date
    Aug 2012
    Location
    Vancouver, Canada
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How do I search for files which contain a specific text string?

    Q1: how do I determine a file's character encoding, using QT?
    ( I can use the CLI and file -i "file name".

    Q2: If I have a text file I can search for a word in it with
    if (aline.contains (" nose bleed"))
    How would I search for the term "nose bleed" in a collection of .odt files, or .doc files?

  2. #2
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How do I search for files which contain a specific text string?

    1. You need to write your own encoding detection code or use something like enca library.
    2. Write the ODT and DOC file parsers. Read files in the cycle, parse each file to extract the text, do the search. The ODT parser for the text extraction puproses only is a relatively simple thing. You need the XML parser and some unzipper for it.

Similar Threads

  1. Replies: 5
    Last Post: 14th February 2011, 15:06
  2. exclude moc files from search in vs addin
    By username2010 in forum Qt Tools
    Replies: 0
    Last Post: 15th November 2010, 14:44
  3. Replies: 1
    Last Post: 22nd July 2010, 18:12
  4. How to search files wihin directory and it's subdirectory
    By Deepak Mishra in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2007, 12:54
  5. How to search a string in xml file with Qt Dom classes
    By doganay44 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2006, 21:16

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.