【发布时间】:2012-07-04 18:32:38
【问题描述】:
假设我有这个:
NSString *str = @"This is a sample string";
我将如何拆分字符串以将每个单词添加到 NSMutableArray 中?
在 VB.net 中你可以这样做:
Dim str As String
Dim strArr() As String
Dim count As Integer
str = "vb.net split test"
strArr = str.Split(" ")
For count = 0 To strArr.Length - 1
MsgBox(strArr(count))
Next
那么如何在 Objective-C 中做到这一点?谢谢
【问题讨论】:
-
我不知道“tokenize”是用于字符串拆分的术语哈哈。不管怎么说,还是要谢谢你! :)
标签: objective-c string