Converting the caps in an NSString into lowercase

I have a issue while doing some encoding with the string. It returns all the values in CAPS. I want it to be small. Is there any api available in objective C to convert the caps in the NSString into small alphabet?


If you want it all lower case you can do [myString lowercaseString];

If you want it capitalized use [myString capitalizedString];

See Apple's Docs on NSString


 NSString *original = @"blah"
 NSString *lowercase = [original lowercaseString];

This code will make the NSString lowercase be original in all lower case.


lowercaseString

(is there a badge for the fourth answer providing the same solution as the three before?)


If you want to use a specific locale (the NSString docs don't seem to indicate what locale the upper/lowercase/capitalise methods use) then you need to use a CFString function:

NSString* inputString = @"input";
NSString* outputString;
NSLocale* locale = [[NSLocale alloc] initWithLocaleIdentifier:@"tr_TR"];

CFMutableStringRef tempCFMString = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)inputString);
CFStringCapitalize(tempCFMString, (CFLocaleRef)locale);
outputString = [[(NSString*)tempCFMString copy] autorelease];
CFRelease(tempCFMString);

//remember to release stuff