swift

Unescaped control character arou

2019-01-25  本文已影响10人  张俊凯
+(NSString *)deleteControlCharacter:(NSString *)originalString{
    NSMutableString *mstring = [NSMutableString stringWithString:originalString];
    NSCharacterSet *controlChars = [NSCharacterSet controlCharacterSet];
    NSRange range = [originalString rangeOfCharacterFromSet:controlChars];
    while (range.location != NSNotFound){//包含
        [mstring deleteCharactersInRange:range];//删除
        range = [mstring rangeOfCharacterFromSet:controlChars];//递归
    }
    return mstring;
}

完。

上一篇 下一篇

猜你喜欢

热点阅读