且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在iOS上将字符串拆分为子字符串?

更新时间:2022-02-28 10:22:15

您还可以拆分字符串一个子字符串,使用NString的 componentsSeparatedByString 方法。

You can also split a string by a substring, using NString's componentsSeparatedByString method.

文档示例:

NSString *list = @"Norman, Stanley, Fletcher";
NSArray *listItems = [list componentsSeparatedByString:@", "];