I was wondering how to capitalize a string found in an object in an NSMutableArray.
An NSArray contains the string 'April' at index 2.
I want this to be changed to 'APRIL'.
Is there something simple like this?
viewNoteDateMonth.text = [[displayDate objectAtIndex:2] capitalized];
Here ya go:
Btw:
"april"islowercase➔ [NSString lowercaseString]"APRIL"isUPPERCASE➔ [NSString uppercaseString]"April May"isCapitalized/Word Caps➔ [NSString capitalizedString]"April may"isSentence caps➔ (method missing; see workaround below)Hence what you want is called “uppercase“, not “capitalized“. 😉
As for “Sentence Caps” one has to keep in mind that usually “Sentence” means “entire string”. If you wish for real sentences use the second method, below, otherwise the first: