How to convert Html tags to plain text in iPhone

ぐ巨炮叔叔 提交于 2019-12-24 06:32:22

问题


I have webservice response like this.

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

I have to convert html tags in the above str to plain text.Can u please suggest me solution for this.


回答1:


You can use NSScanner class to parse the HTML.

Have a look at this post: How to convert NSString HTML markup to plain text NSString?



来源:https://stackoverflow.com/questions/8959700/how-to-convert-html-tags-to-plain-text-in-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!