开发者

Convert NSString in NSArray

I'm searching for a Objective-C method like PHP's explode function:

$string = "Helle#world#!";
$delimiter = "#";
$array = explode ( $delimiter, $string);

Result: $array = {"Hello", "wo开发者_如何学JAVArld", "!"}

Thanks, Andreas


You're looking for componentsSeparatedByString:

NSString *string = @"Hello#world#!";
NSString *delimiter = @"#";
NSArray *array = [string componentsSeparatedByString:delimiter];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜