“ 和 ” 是HTML中的双引号,在java中要使用StringEscapeUtils的unescapeHtml4()方法进行转换
1.添加依赖implementation 'org.apache.commons:commons-lang3:3.9'
2.导包import org.apache.commons.lang3.StringEscapeUtils
发现lang3.StringEscapeUtils已经弃用
3.需要添加
implementation 'org.apache.commons:commons-text:1.8'
4.导包
import org.apache.commons.text.StringEscapeUtils;
使用即可
String newStr = StringEscapeUtils.unescapeHtml4("“你能做个淘宝、微信吗?” ");
//“你能做个淘宝、微信吗?”
5.附
Android Apache Commons工具库依赖列表
ps:
<em class='highlight'></em>,使用Html.fromHtml()方法,转化为斜体