[Biococoa-dev] finding characters in an NSString

Jim Balhoff james.balhoff at duke.edu
Sun Nov 21 12:08:27 EST 2004

On Nov 20, 2004, at 10:53 PM, Koen van der Drift wrote:

> Hi,
> Just spend over an hour trying to figure out how to determine if an 
> NSString contains one or more characters from an NSCharacterSet. 
> Aaaarrrggghhhh. There is no such thing in the Foundation Kit (at 
> least, I couldn't find it).
> How do I do this?

How about:

NSCharacterSet *set = [NSCharacterSet 

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.


James P. Balhoff
Dept. of Biology
Duke University
Durham, NC 27708-0338

More information about the Biococoa-dev mailing list