目标c中componentsSeparatedByString的含义是什么? [英] what is the meaning of componentsSeparatedByString in objective c?

查看:59
本文介绍了目标c中componentsSeparatedByString的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标c中componentsSeparatedByString的含义是什么?

what is the meaning of componentsSeparatedByString in objective c?

NSArray *customerNameArray=[[[arrTemp objectAtIndex:0] objectForKey:@"CustomerNames"] componentsSeparatedByString:@";"];

在上面的代码行中如何使用它,这里arrTemp是MSMutableArray的对象.

how is it used in the above line of code,here arrTemp is an object of a MSMutableArray.

推荐答案

componentsSeparatedByString:类似于Java中的StringTokenizer.它将基于给定的分隔符将给定的字符串拆分为一个数组.例如

componentsSeparatedByString: is like StringTokenizer in Java. It splits the given string into an array based on the given separator. For example,

NSString *namesStr =  @"John;Michael;Jason";
NSArray *namesArray = [namesStr componentsSeparatedByString:@";"];

结果,namesArray将包含字符串@"John"@"Michael"@"Jason".

As the result, namesArray will contain the strings @"John", @"Michael" and @"Jason".

这篇关于目标c中componentsSeparatedByString的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆