• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Text Searching system...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text Searching system...


  • Subject: Re: Text Searching system...
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 14 Sep 2009 10:18:08 -0700


On Sep 11, 2009, at 4:47 AM, Farooq zaman wrote:

I want to develop a text searching system for my application. This system should search for a search expressions in all files present is a particular project directory. Can anybody tell me what COCOA classes used for text searching?

There isn't anything in Cocoa that will search through files. You could read a file into memory using +[NSString stringWithContentsOfFile:usedEncoding:error] and then use -[NSString rangeOfString:] to look for string you want to match, but this will be really inefficient, especially with large files or large numbers of files.


If you need to search for general patterns, not just literals, look into RegexKitLite.

Optimally you'd want to open each file as a stream and read through it for the pattern. (You might want to read up on efficient string-search algorithms like Boyer-Moore or Rabin-Karp.) You can do this using standard C or POSIX file APIs.

—Jens_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Text Searching system... (From: Farooq zaman <email@hidden>)

  • Prev by Date: Re: coding NSNumber in NSArray?
  • Next by Date: Re: coding NSNumber in NSArray?
  • Previous by thread: Text Searching system...
  • Next by thread: Audio Unit problem in Snow Leopard
  • Index(es):
    • Date
    • Thread