PHP有用strip_tags
函数地带HTML和字符串中的PHP代码。
PHP has strip_tags
function which Strip HTML and PHP tags from a string.
是否必须的android逃脱HTML?
Does android have a means to escape html?
在答案的解决方案,通过@sparkymat链接到一般要求要么正则表达式 - 这是一个容易出错的方法 - 或安装第三方库,如< A HREF =http://jsoup.org/> jsoup 或杰里科。在Android设备上更好的解决办法就是要利用Html.fromHtml()函数的:
The solutions in the answer linked to by @sparkymat generally require either regex - which is an error-prone approach - or installing a third-party library such as jsoup or jericho. A better solution on Android devices is just to make use of the Html.fromHtml() function:
public String stripHtml(String html) {
return Html.fromHtml(html).toString();
}
本使用内置的HTML解析器来构建一个跨区
重新输入HTML的presentation没有任何html标签Android的。而跨度的标记,然后通过转换输出回字符串剥离。
This uses Android's built in Html parser to build a Spanned
representation of the input html without any html tags. The "Span" markup is then stripped by converting the output back into a string.
上一篇:有没有办法直接使用SpeechRecognizer API进行语音输入?没有办法、语音、直接、SpeechRecognizer
下一篇:燮preSS /块的BroadcastReceiver在另一个应用程序应用程序、preSS、BroadcastReceiver