Using lowercasestring,uppercasestring
-(void) test{ nsstring *teststring = @ "Hello World"; Lower case NSString *lowercasestring1 = [teststring lowercasestring]; NSString *lowercasestring2 = teststring.lowercasestring; Upper Case NSString *uppercasestring1 = [lowerCaseString1 uppercasestring]; NSString *uppercasestring2 = lowercasestring1.uppercasestring; NSLog (@ "lowerCaseString1:%@", lowerCaseString1); NSLog (@ "lowerCaseString2:%@", lowerCaseString2); NSLog (@ "upperCaseString1:%@", upperCaseString1); NSLog (@ "upperCaseString2:%@", upperCaseString2); Capitalize the first word of the sentence nsstring *txt = @ "Hi my friends!"; TXT = [txt stringbyreplacingcharactersinrange:nsmakerange (0,1) withstring:[[txt substringtoindex:1] uppercaseString] ]; NSLog (@ "txt:%@", txt);}
Printing results:
2014-08-26 17:00:30.266 myapp[68821:60b] Lowercasestring1:hello world2014-08-26 17:00:30.267 MyApp[68821:60b] Lowercasestring2:hello world2014-08-26 17:00:30.267 myapp[68821:60b] Uppercasestring1:hello world2014-08-26 17:00:30.267 myapp[68821:60b] Uppercasestring2:hello world2014-08-26 17:00:30.268 MyApp[68821:60b] Txt:hi my friends!
Reference Source:
Http://stackoverflow.com/questions/8693741/converting-all-text-to-lower-case-in-objective-c
Http://stackoverflow.com/questions/2432452/how-to-capitalize-the-first-word-of-the-sentence-in-objective-c
IOS changes the case of letters