如何从iOS上的解析文本中删除HTML标记? [英] How to remove html tags from a parsed text on iOS?

查看:111
本文介绍了如何从iOS上的解析文本中删除HTML标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在解析一个文本并将它存储在一个NSString变量中。但是,当我尝试在屏幕上显示NSString时,我可以在文本中看到如下标签:< br> 。如何从我的文本中删除这些标签并将其替换为空格或其他内容?

I am parsing a text and store it in a NSString variable. However when I try to display the NSString on screen I can see, within the text, the html tags like: <br>. How can I remove this tags from my text and replace them with a space or something?

推荐答案

NSString *str = @"This is<br>a string";

str = [str stringByReplacingOccurrencesOfString:@"<br>" withString:@""];

这篇关于如何从iOS上的解析文本中删除HTML标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆