UITextView formatting
I have a UITextView that shows me the following: 333, nik, 222
开发者_运维知识库I just want to separate these texts and to show me:
Number: 333
User: nik
Visits: 222
how I can do?
NSString *longString = myTextView.text;
NSArray *array = [longString componentsSeparatedByString:@", "];
NSString *formattedString = [NSString stringWithFormat:@"Number: %@ User: %@ Visits: %@", [array objectAtIndex:0], [array objectAtIndex:1], [array objectAtIndex:2]];
UITextView *textView;
textView.text = @"Number: 333\nUser: nik\nVisits: 222";
精彩评论