Displaying the contents in a text box in all uppercase
In my app i have a text box and i am required to perform some validations in it .And also separating the contents present in the text box based on space between them and storing them in an array for further use.Now i want that the input is provided thorugh the text box is all converted to UPPERCASE before being split using spaces.I have already searched many places but havent found开发者_如何学JAVA anything.This is my last option now,please help.My code is:-
wordsInSentence = [youSaid.text componentsSeparatedByString:@" "];
i want to bring the text in youSaid(my text box) in UPPERCASE and then storing them into an array by splitting with space.
Thanks,
Christy
To get the uppercase string:
NSString *uppercaseString = [textField.text uppercaseString];
And, if you want the text field to display text in upper case(while typing), use autocapitalizationType property.
textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
NSString* uppercase = [youStaid.text uppercaseString];
wordsInSentence=[uppercase componentsSeparatedByString:@" "];
精彩评论