• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa equivalent of strspn(3)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Cocoa equivalent of strspn(3) (From: "Paul J. Lucas" <email@hidden>)

  • Prev by Date: FIXED - Re: custom frameworks: dynamic link errors
  • Next by Date: error: cannot find interface declaration for 'SNSDisclosableView', superclass of 'RCDDDisclosableView'
  • Previous by thread: Cocoa equivalent of strspn(3)
  • Next by thread: error: cannot find interface declaration for 'SNSDisclosableView', superclass of 'RCDDDisclosableView'
  • Index(es):
    • Date
    • Thread