首页 > 代码库 > nsstring 字符串去掉空格换行和括号

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

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

{

    NSString *realSre = [sourceStrstringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceAndNewlineCharacterSet]];

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

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

    NSString *realSre3 = [realSre2stringByReplacingOccurrencesOfString:@" "withString:@""];

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

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

    

    NSArray *array = [realSre5componentsSeparatedByString:@","];

    

    return [arrayobjectAtIndex:0];

}

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