如何使用swift程序从htmlString中删除反斜杠?

时间:2018-10-16 05:24:31

标签: swift3

https://d30er1j1ecun0i.cloudfront.net/check-square.png \“ alt = \” check_box \“ style = \”宽度:100%;显示:阻止; \“ />国家排名https:// d30er1j1ecun0i .cloudfront.net / check-square.png \“ alt = \” check_box \“ style = \”宽度:100%;显示:阻止; \“ />访问资源指南-每周培训指南-营养-招聘https:// /d30er1j1ecun0i.cloudfront.net/check-square.png \“ alt = \” check_box \“ style = \”宽度:100%;显示:阻止; \“ />最新的扩展报告-大学排名-全国在每个测试中的排名https://d30er1j1ecun0i.cloudfront.net/check-square.png \“ alt = \” check_box \“ style = \”宽度:100%;显示:阻止; \“ />实时事件排行榜https:// d30er1j1ecun0i.cloudfront.net/check-square.png \“ alt = \” check_box \“ style = \”宽度:100%;显示:阻止; \“ />通过VIP访问其他营地和联合地

1 个答案:

答案 0 :(得分:0)

let htmlString = "https://d30er1j1ecun0i.cloudfront.net/check-square.png\" alt=\"check_box\" style=\"width: 100%;display: block;\"/>National Rankinghttps://d30er1j1ecun0i.cloudfront.net/check-square.png\" alt=\"check_box\" style=\"width: 100%;display: block;\"/>Access to Resource Guide - Weekly Training Guide - Nutrition - Recruitinghttps://d30er1j1ecun0i.cloudfront.net/check-square.png\" alt=\"check_box\" style=\"width: 100%;display: block;\"/>Up-to-date Expanded Report - College Ranking - National Ranking in each Testhttps://d30er1j1ecun0i.cloudfront.net/check-square.png\" alt=\"check_box\" style=\"width: 100%;display: block;\"/>Live Event Leaderboardhttps://d30er1j1ecun0i.cloudfront.net/check-square.png\" alt=\"check_box\" style=\"width: 100%;display: block;\"/>VIP access to additional camps and combines"

htmlString.replacingOccurrences(of: "\\", with: "")
print(htmlString)

然后结果应该不再包含任何反斜杠