去掉NSString中的HTML标签
来源:互联网 发布:矩阵奇异值和特征值 编辑:程序博客网 时间:2024/05/16 08:42
m
- (NSString *)flattenHTML:(NSString *)html trimWhiteSpace:(BOOL)trim
- {
- NSScanner *theScanner = [NSScanner scannerWithString:html];
- NSString *text = nil;
- while ([theScanner isAtEnd] == NO) {
- // find start of tag
- [theScanner scanUpToString:@"<" intoString:NULL] ;
- // find end of tag
- [theScanner scanUpToString:@">" intoString:&text] ;
- // replace the found tag with a space
- //(you can filter multi-spaces out later if you wish)
- html = [html stringByReplacingOccurrencesOfString:
- [ NSString stringWithFormat:@"%@>", text]
- withString:@""];
- }
- return trim ? [html stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] : html;
- }
调用方法:
notification33.alertBody =[self flattenHTML:body trimWhiteSpace:YES];
0 0
- 去掉NSString中的HTML标签
- 去掉NSString中的HTML标签
- 去掉NSString中的HTML标签
- 去掉 NSString 中的html标签
- NSString去掉html标签
- 去掉<textarea>中的html标签
- 去掉内容中的所有全部html标签。
- 去掉内容中的所有html标签
- 去掉内容中的所有全部html标签
- 去掉字符串中的HTML标签-记录
- android 去掉字符串中的html标签
- 去掉html代码字符中的标签符号
- 去掉HTML的标签
- java去掉html标签
- js去掉HTML标签
- 去掉HTML标签
- java去掉html标签
- 去掉HTML标签
- ImageLoader
- iOS MBProgressHUD的简单使用
- 多项选择~checkbox的简单运用
- Android 坐标系
- Linux下tcpdump和Wireshark抓包的数据结构
- 去掉NSString中的HTML标签
- 更新api/current.txt文件
- 20151106AS 中 Gradle 配置运行浅析@佟飞
- 使用Android Studio对代码进行重构
- JavaScript 通过特定的年份和月份确定相应的天数
- guava cache 存储的数据结构3 之 ValueReference -- 4
- Android UI开发神兵利器之设计资源
- dedecms首页调用文章发布作者的名称和头像
- c++之枚举