我对将字符串拆分为子字符串有一点疑问。 我想在一个标签中显示州名和国家名。我在来自 json 文件“FullAddress”的服务中有一个字符串:“New Windsor,New York,USA”。我只想在标签中显示美国纽约。
最佳答案
使用它并从 Array
元素 1 和 2 中获取您想要的 String
NSArray *strings = [FullAddress componentsSeparatedByString:@","];
关于ios - 在 iOS 中将字符串拆分为子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37936452/