iOS去掉html 的转义符号
来源:互联网 发布:楼层网络布局图 编辑:程序博客网 时间:2024/06/04 07:21
NSString *htmlString = @"[{\"age\":18,\"book\":{\"price\":23.2,\"title\":\"booooooook1\"},\"name\":\"samyou\"},{\"age\":22,\"book\":{\"price\":21,\"title\":\"booooooook2\"},\"name\":\"samsam\"}]"; NSLog(@"==htmlString 转成 jsonString ==%@",[self filterHTML:htmlString]);
-(NSString *)filterHTML:(NSString *)html{ NSScanner * scanner = [NSScanner scannerWithString:html]; NSString * text = nil; while([scanner isAtEnd]==NO) { //找到标签的起始位置 [scanner scanUpToString:@"<"intoString:nil]; //找到标签的结束位置 [scanner scanUpToString:@">"intoString:&text]; //替换字符 html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>",text]withString:@""]; } // NSString * regEx = @"<([^>]*)>"; // html = [html stringByReplacingOccurrencesOfString:regEx withString:@""]; return html;}
转换结果:
转换成json:
0 0
- iOS去掉html 的转义符号
- iOS去掉html 的转义符号
- html中几个符号的转义
- HTML转义符号
- HTML转义符号
- html符号转义
- java处理html转义符号
- IOS html转义开源库
- HTML转义符号(比较全)
- iOS 去掉HTML标签
- iOS 去掉html标签
- 数据库里面的转义符号
- & 符号在 SQLPLUS 的转义
- ibatis $符号#号的转义
- & 符号在 SQLPLUS 的转义
- 去掉html代码字符中的标签符号
- html方便的转义
- HTML的转义字符
- springmvc+mybatis登录验证2.0(更新了使用session来进行保存用户值,注销后清除session),并进行了拦截器的设定
- 迭代器模式
- html5 ajax文件上传
- 算法学习
- test
- iOS去掉html 的转义符号
- JDK1.8新特性(二)Lambda表达式入门
- 命令行小游戏Beta1.0
- Error:Execution failed for task ':DistAndroidMapPhone:transformClassesWithDexForDebug
- 对IEEE 802.15.4中Slotted CSMA-CA的理解
- CSS绘制步骤条 ( 三角形)
- Android File.list().length == 0判断文件夹是否为空抛出空指针异常解决
- 根据数据库中字段的不同数字,页面使用不同的html标签
- 将时间转化成今天、昨天和前天格式