html - 如何在 iPhone 中将 Html 标签转换为纯文本

标签 html objective-c ios nsstring

我有这样的网络服务响应。

NSString *str= @"Slight <b>left</b> onto <b>Adelaide Rd/B509</b><div style="font-size:0.9em">Continue to follow Adelaide Rd</div>";

我必须将上面 str 中的 html 标签转换为纯文本。你能给我建议吗 解决方案。

最佳答案

您可以使用 NSScanner解析 HTML 的类。

看看这篇文章: How to convert NSString HTML markup to plain text NSString?

关于html - 如何在 iPhone 中将 Html 标签转换为纯文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8959700/

相关文章:

objective-c - 在 objective-c 中使用 @synchronized 指令的死锁和活锁问题

ios - `UICollectionViewLayout` 如何访问不可见单元格的数据?

ios - 如何发送方法以从 UIButton 调用的操作中查看

html - 仅在移动设备上显示 Bootstrap 导航栏。

html - 使用身份验证从动态内容提供程序加载 html5 音频

ios - 在 objc 中使用 swift 框架

iphone - 为什么我的 UIImages 电影会失真?

android - 强制登录 jQuery Mobile/Phonegap 应用程序重新启动

html - 当图像试图在图像上显示文字时,另一个 div 被切成两半

html - html 中的超链接不适用于嵌入式代码