用于iPhone应用程序开发的Objective-C中的字符串标记器 [英] String tokenizer in Objective-C for iPhone application development

查看:64
本文介绍了用于iPhone应用程序开发的Objective-C中的字符串标记器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Objective-C 中为 iPhone应用程序

我的结果是:


1 | 101 | Y | 103 | Y | 105 | Y | 107 | Y | 109 | Y | 111 | Y | 113 | Y | 115 | Y |

1|101|Y|103|Y|105|Y|107|Y|109|Y|111|Y|113|Y|115|Y|

我想对此字符串进行标记,并以表格格式显示每个值。我该怎么做?

I want to tokenize this string and display each of the values in tabular format. How am I to do it?

我希望结果以表格格式显示。喜欢:

I want the result in a tabular format. Like:

102 Y
103 Y
..  ...


推荐答案

如果通过令牌化来表示只是拆分管道标志,那么你可以使用 componentsSeparatedByString:方法 NSString

If by "tokenizing" you mean simply "splitting on the pipe-sign", you can use the componentsSeparatedByString: method of NSString:

 NSString *original = @"1|101|Y|103|Y|105…";
 NSArray *fields = [original componentsSeparatedByString:@"|"];

以表格格式显示并没有多说。如果您需要经典表格,请参阅 UITableView class。

"Displaying in a tabular format" doesn’t say much. If you want a classic table, see the UITableView class.

这篇关于用于iPhone应用程序开发的Objective-C中的字符串标记器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆