按指定格式的子字符串,删除和分割字符串

删除就用
- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;
将@“[:1:]"”,替换成@“”

分割就用
- (NSArray *)componentsSeparatedByString:(NSString *)separator;
根据你选定分割符拆分字符串

 

IOS字符串按特定字符拆分成数组

NSString * fruits = @"apple,pair,banana,orange";

NSArray * array= [fruits componentsSeparatedByString:@","];

posted @ 2014-07-04 16:05  yangyuxiaozi  阅读(241)  评论(0编辑  收藏  举报