iOS 去掉HTML标签
来源:互联网 发布:淘宝网的运费险怎么用 编辑:程序博客网 时间:2024/05/21 09:42
// 去掉HTML标签
- (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;
}
- (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;
}
0 0
- iOS 去掉HTML标签
- iOS 去掉html标签
- 去掉HTML的标签
- java去掉html标签
- js去掉HTML标签
- 去掉HTML标签
- java去掉html标签
- 去掉HTML标签
- java 去掉html标签
- NSString去掉html标签
- mysql去掉html标签
- java 去掉html标签
- ios去掉字符串中的html标签的方法
- ios去掉字符串中的html标签的方法
- ios去掉字符串中的html标签的方法
- IOS去掉字符串中的html标签的方法
- java去掉html标签 必须首先去掉 "
- 去掉html标签的js
- Neutron/L3 High Availability VRRP
- PAT-B 1025. 反转链表
- 三点一刻CEO蔡浩宇亮相2016GMIC并发表演讲 引领智能公关新时代
- hbase表结构
- zookeeper安装
- iOS 去掉HTML标签
- Android剪贴板
- Spring代理模式、AOP编程、jdbc支持
- 基于websocket的多人页面聊天室
- 在eclipse下,给ArduCopter飞控,添加subMenuTest指令
- 在 linux 下使用 CMake 构建应用程序
- Lucene多线程创建索引及多目录下查询索引
- getInstalledPackages、ResolveInfo 获取apk的信息
- Linux 下面jdk 安装