Re: Searching NSString

2007-05-02 Thread Daniel J Farrell
Hi everyone, WOW a lot of responses! Thanks for your help. I didn't pick up on the -rangeOfString: method as useful for searching when looking through the documentation. But I see how it fits in now. Cheers! Dan. ___ Discuss-gnustep mailing

Re: Searching NSString

2007-05-01 Thread Sašo Kiselkov
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Daniel J Farrell wrote: Hello, What is the easiest way to search the contents of an NSString for the occurrence of a word? For example, if I have @GNUStep is really cool, how can I find out if this contains the string @cool? I just need

Re: Searching NSString

2007-05-01 Thread Adam Fedor
On May 1, 2007, at 11:38 AM, Sašo Kiselkov wrote: BOOL ContainsString (NSString *string, NSString *keyword) { return [string rangeOfString: keyword].location != NSNotFound; } Slightly better: BOOL ContainsString (NSString *string, NSString *keyword) { return (string != NULL) ([string

Re: Searching NSString

2007-05-01 Thread Sašo Kiselkov
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Adam Fedor wrote: On May 1, 2007, at 11:38 AM, Sašo Kiselkov wrote: BOOL ContainsString (NSString *string, NSString *keyword) { return [string rangeOfString: keyword].location != NSNotFound; } Slightly better: BOOL ContainsString