美文网首页
Html格式 文本输出(删除制表符)

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

作者: Lin__Chuan | 来源:发表于2017-04-24 14:42 被阅读112次
    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格式数据

    相关文章

      网友评论

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

          本文链接:https://www.haomeiwen.com/subject/oehpzttx.html