On 11/08/2008, at 11:29 PM, Ron Fleckner wrote:


On 11/08/2008, at 10:52 PM, Macarov Anatoli wrote:

HI!
Cocoa, Obj-C.
How to check the capital letter?

Hi, I don't remember if there is a Cocoa solution, but of course you can use plain C:

        NSString *str = @"Aa";
        char first = [str characterAtIndex:0];
        char second = [str characterAtIndex:1];
NSLog(@"%c is [EMAIL PROTECTED]", first, isupper(first) ? @"uppercase" : @"lowercase"); NSLog(@"%c is [EMAIL PROTECTED]", second, isupper(second) ? @"uppercase" : @"lowercase");

Result:
        
        A is uppercase.
        a is lowercase.


Forgot to mention: this isn't plain C, but a function from the C library. No need to explicitly link, it just works.

Ron
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to