码迷,mamicode.com
首页 > 其他好文 > 详细

nsstring 字符串去掉空格换行和括号

时间:2015-01-15 16:04:31      阅读:554      评论:0      收藏:0      [点我收藏+]

标签:字符串 空格 换行

+ (NSString *)handleSpaceAndEnterElementWithString:(NSString *)sourceStr

{

    NSString *realSre = [sourceStr stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

    NSString *realSre1 = [realSre stringByReplacingOccurrencesOfString:@"\r" withString:@""];

    NSString *realSre2 = [realSre1 stringByReplacingOccurrencesOfString:@"\n" withString:@""];

    NSString *realSre3 = [realSre2 stringByReplacingOccurrencesOfString:@" " withString:@""];

    NSString *realSre4 = [realSre3 stringByReplacingOccurrencesOfString:@"(" withString:@""];

    NSString *realSre5 = [realSre4 stringByReplacingOccurrencesOfString:@")" withString:@""];

    

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

    

    return [array objectAtIndex:0];

}

nsstring 字符串去掉空格换行和括号

标签:字符串 空格 换行

原文地址:http://blog.csdn.net/zh_2608/article/details/42741727

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!