I have some strings like NAVJYOT COMPLEX, NEAR A ONE SCHOOL, SUBHASH CHOWK , MEMNAGAR, Ahmedabad, Gujarat, India.
I want to convert them so the first character is uppercase and remaining are lowercase, e.g: Navjyot Complex, Near A One School, Subhash Chowk, Memnagar, Ahmedabad, Gujarat, India. So please help me convert those strings.
Thanks in advance.
A static, plain-text Unicode string object which you use when you need reference semantics or other Foundation-specific behavior.
string capitalize() in Python Python String capitalize() method returns a copy of the original string and converts the first character of the string to a capital (uppercase) letter, while making all other characters in the string lowercase letters.
The uppercased() method converts all lowercase characters in a string into uppercase characters.
nsstring has the following method
capitalizedString
it returns:
"A string with the first character from each word in the receiver changed to its corresponding uppercase value, and all remaining characters set to their corresponding lowercase values."
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html
use This one
NSString *str1 = @"ron";
NSString *str = [str1 capitalizedString];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With