Html格式 文本输出(删除制表符)

2017-04-24  本文已影响112人  Lin__Chuan
Screenshot 2017-04-24_14-15-32.png
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    NSCharacterSet *controlChars = [NSCharacterSet controlCharacterSet];
    NSRange range = [responseString rangeOfCharacterFromSet:controlChars];
    if (range.location != NSNotFound)
    {
        NSMutableString *mutable = [NSMutableString stringWithString:responseString];
        while (range.location != NSNotFound)
        {
            [mutable deleteCharactersInRange:range];
            range = [mutable rangeOfCharacterFromSet:controlChars];
        }
        responseString = mutable;
    }
data = [responseString dataUsingEncoding:NSUTF8StringEncoding];

选择并删除其中的制表符,转化为UTF-8格式数据

上一篇下一篇

猜你喜欢

热点阅读