Re: Cocoa equivalent of strspn(3)
Re: Cocoa equivalent of strspn(3)
- Subject: Re: Cocoa equivalent of strspn(3)
- From: Justin Anderson <email@hidden>
- Date: Mon, 10 Oct 2005 02:36:42 -0400
Look at NSCharacterSet. <http://developer.apple.com/documentation/
Cocoa/Reference/Foundation/ObjC_classic/Classes/NSCharacterSet.html>
Basically do this:
NSCharacterSet *firstSet = [NSCharacterSet
characterSetWithCharactersInString:first];
NSCharacterSet *secondSet = [NSCharacterSet
characterSetWithCharactersInString:second];
if ([secondSet isSupersetOfSet:firstSet] == NO) {
// ... there's a char in first not in second
}
Justin Anderson
On Oct 10, 2005, at 2:13 AM, Paul J. Lucas wrote:
I have two NSStrings. I want to see if the first contains any
character that is not in the second. I basically want the
equivalent of:
if ( strspn( first, second ) < strlen( first ) )
// ... there's a char in first not in second
What's the easiest way to do this using Cocoa NSStrings?
- Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden