HardCode HardCode - 1 year ago 118
Objective-C Question

How to make First letter upper case on objective-c?

I'm developing an iPhone app. I want to show the user's first letter of the name upper case and the rest lower case. How do I do that on objective-C?

Answer Source

If there is only one word-NSString, then use the method


NSString *capitalizedString = [myStr capitalizedString]; // capitalizes every word

Otherwise, for multi word strings, you have to extract first character and make only that character upper case.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download