Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是该网站的新手。有谁知道是否可以获取一条推文并将其中的信息拆分为 Xcode 中的单独部分?例如......如果推文阅读......“天空新闻:这是标题:12/04/12:这是消息的正文”我可以将用冒号分隔的块提取为单独的字符串,以便一个字符串可能是“天空新闻”一个“这是标题......等等?提前谢谢Al
您可以将-[NSString componentsSeparatedByString:]字符串拆分为字符串数组。
-[NSString componentsSeparatedByString:]
NSArray *arr = [@"This: is: a: string" componentsSeparatedByString:@":"];
现在数组arr将有 4 个项目。
arr