Re: Is anyone familiar with NSStringrangeOfCharacterFromSet:options
Re: Is anyone familiar with NSStringrangeOfCharacterFromSet:options
- Subject: Re: Is anyone familiar with NSStringrangeOfCharacterFromSet:options
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Wed, 21 Jan 2009 22:42:53 -0500
On Jan 21, 2009, at 9:41 PM, David Yamartino wrote:
Hi All,
I need to write an application where the user inputs a search term
and the app looks in a folder and subfolders containing text files
and then displays not just the location of the documents containing
the search string, but the context of each instance (maybe a few
sentences before and after - or maybe just sends you to that part of
the document where you can read before and after).
The "Search Kit Programming Guide" gives a "complete search method"
under Listing 3-19 (see below), but it also states that it only
finds documents, not the "position of a term within a document":
To Search Kit, a document is atomic in that it defines the
granularity of a search. Using Search Kit, your application can find
documents—as your application understands them—but cannot locate the
position of a term within a document. If you want to locate matches
for a user's query within a found document, use the MLTE TXNFind
function in Carbon or the NSStringrangeOfCharacterFromSet:options:
method in Cocoa.
I can't find any documentation on this method. If are familiar with
it, I would appreciate any help you could provide.
The method you're looking for is -[NSString rangeOfCharacterFromSet:]
and related methods. See the NSString documentation, under 'Finding
Characters and Substrings'.
http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html
Also, I'm thinking that the program I have in mind (since it's quite
basic) may already be written and available some where. If you are
aware of anything, I'd appreciate your help,
Thanks,
David
I'd be very surprised if something like this didn't exist already. I'd
look into existing command line utilities and NSTask first, if I were
you. Of course, that depends on what exactly you're trying to do.
Hope this helps,
Hank
PS. Your question would be better asked on the cocoa-dev list, for
future reference.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden