Remove HTML tags from a String

后端 未结 30 3862
误落风尘
误落风尘 2020-11-21 07:35

Is there a good way to remove HTML from a Java string? A simple regex like

replaceAll("\\\\<.*?>", &quo         


        
30条回答
  •  暖寄归人
    2020-11-21 08:04

    You can simply use the Android's default HTML filter

        public String htmlToStringFilter(String textToFilter){
    
        return Html.fromHtml(textToFilter).toString();
    
        }
    

    The above method will return the HTML filtered string for your input.

提交回复
热议问题