[Biococoa-dev] finding characters in an NSString
Koen van der Drift
kvddrift at earthlink.net
Sun Nov 21 12:43:30 EST 2004
> How about:
>
> NSCharacterSet *set = [NSCharacterSet
> characterSetWithCharactersInString:theString];
>
> BOOL characterIsInString = [set characterIsMember:someUnichar];
>
> I guess you would have to loop through the unichar's in your set.
>
> Or maybe [theString rangeOfCharacterFromSet:aSet] would be helpful.
>
> Just some guesses.
Hi Jim,
Welcome back :)
This seems to work:
if ( [theString rangeOfCharacterFromSet: aSet].location != NSNotFound )
which will return YES if one or more of the characters are in the
string.
cheers,
- Koen.
More information about the Biococoa-dev
mailing list