• 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
NSString categories
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString categories


  • Subject: NSString categories
  • From: Marten van Gelderen <email@hidden>
  • Date: Thu, 19 Feb 2004 12:39:48 +0100

Hallo list,

I have implemented two (interesting?) categories on NSString which I thought convenient.

- (BOOL)isIntegerString
{
NSScanner *scanner = [NSScanner scannerWithString: self];
return [scanner scanInt: nil] && [scanner isAtEnd];
}

- (BOOL)isAlphanumericString
{
NSScanner *scanner = [NSScanner scannerWithString: self];
return [scanner scanCharactersFromSet: [NSCharacterSet alphanumericCharacterSet] intoString: nil] && [scanner isAtEnd];
}

They work fine for me. I also wanted to implement the following "isCapitalizedString" but that does not work.

- (BOOL)isCapitalizedString
{
NSScanner *scanner = [NSScanner scannerWithString: self];
return [scanner scanCharactersFromSet: [NSCharacterSet capitalizedLetterCharacterSet] intoString: nil] && [scanner isAtEnd];
}

It is obvious that I do not understand what the "[NSCharacterSet capitalizedLetterCharacterSet]" contains. The docs say only that it contains the "characters in the category of Titlecase Letters", whatever that may be (upper?, lower? first upper, then lower?).

Any help is appreciated.
--
Groeten, Marten
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: red black trees
  • Next by Date: Re: red black trees
  • Previous by thread: Compiling trouble
  • Next by thread: Re: NSString categories
  • Index(es):
    • Date
    • Thread