问题
I have one string as follows:
NSString *str = @"abcd,efgh";
Now I want to convert this string into NSMutableArray like
NSMutableArray *arr = {abcd,efgh};
then how can I do this?
any help would be appreciated.
回答1:
NSArray *arr = [@"abcd,efgh" componentsSeparatedByString:@","];
should do the job.
来源:https://stackoverflow.com/questions/15271450/convert-nsstring-to-nsarray