开发者

UITextView formatting

开发者 https://www.devze.com 2023-03-12 10:37 出处:网络
I have a UITextView that shows me the following: 333, nik, 222 开发者_运维知识库I just want to separate these texts and to show me:

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";
0

精彩评论

暂无评论...
验证码 换一张
取 消