如何使用 Objective-C 用空格分隔字符串?
假设我有一个像这样的字符串:
hello world this may have lots of sp:ace or little space
我想将此字符串与此分开:
@"hello", @"world", @"this", @"may", @"have", @"lots", @"of", @"sp:ace", @"or", @"little", @"space"
谢谢。
Assume that I have a String like this:
hello world this may have lots of sp:ace or little space
I would like to seperate this String to this:
@"hello", @"world", @"this", @"may", @"have", @"lots", @"of", @"sp:ace", @"or", @"little", @"space"
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我建议采用两步法:
I'd suggest a two-step aproach:
这对我有用
This has worked for me
使用块来做到这一点非常容易,尝试这样的事情:
It's very easy to do this with blocks, try something like this :