How do I detect if a character is uppercase or lowercase?

Funkybit picture Funkybit · Jun 15, 2011 · Viewed 12k times · Source

Let's say I extract a single character from a NSString like this:

[@"This is my String" characterAtIndex:0]

How do I find out if the character I get is a lowercase or uppercase character?

Thanks for any adivice!

Answer

Simon Lee picture Simon Lee · Jun 15, 2011
BOOL isUppercase = [[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[s characterAtIndex:0]];