HardCode HardCode - 3 months ago 14
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

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

-capitalizedString

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.

Comments