Reputation: 1
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?
Upvotes: 0
Views: 567
Reputation: 22284
UITextView *textView;
textView.text = @"Number: 333\nUser: nik\nVisits: 222";
Upvotes: 0
Reputation: 1423
NSString *longString = myTextView.text;
NSArray *array = [longString componentsSeparatedByString:@", "];
NSString *formattedString = [NSString stringWithFormat:@"Number: %@ User: %@ Visits: %@", [array objectAtIndex:0], [array objectAtIndex:1], [array objectAtIndex:2]];
Upvotes: 1