You can add this extension to convert your html code to a regular string:
来源:互联网 发布:开淘宝店投资多少 编辑:程序博客网 时间:2024/05/04 17:58
extension String { var html2AttributedString: NSAttributedString? { guard let data = data(using: .utf8) else { return nil } do { return try NSAttributedString(data: data, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: String.Encoding.utf8.rawValue], documentAttributes: nil) } catch let error as NSError { print(error.localizedDescription) return nil } } var html2String: String { return html2AttributedString?.string ?? "" }}
0 0
- You can add this extension to convert your html code to a regular string:
- How can I convert printStackTrace message to a string?
- What Can Happen When You Try to Convert a Standard SharePoint 2010 Farm to Enterprise
- convert a string to XmlElement
- when the preview menu is diabled in BO, you can add this setting to enabled it
- How to convert a String to DateTime
- convert Structured Exception Code to string
- mysql You can turn off this feature to get a quicker startup with –A
- do your test before you deliver your code to community
- KB: Sample Code - How to add video to your UI
- convert List<String> to a String
- Convert a String to a Number
- openshift:Perhaps your account does not have write access to this directory? You can change the cac
- Tips You Can Use To Improve Your Memory
- Convert a string to an enum
- experiment : convert a string to crc32
- Read/convert an InputStream to a String
- Python convert a list to String
- 系统学习数据挖掘
- 安装OpenJDK1.8
- vue-auto-focus:控制自动聚焦行为的vue指令
- 当面试官问「你有什么要问我的吗」时,应该问什么?
- openresty安装LuaXml
- You can add this extension to convert your html code to a regular string:
- ftp 自动下载文件并解压
- well,这是第一次的记录
- 求外接圆面积
- DC、CDC
- 数字签名介绍
- web端性能测试之发压篇
- java反射浅析
- [算法]字符串匹配算法KMP(java)