Home > Java > javaTutorial > To remove html tags in java, you must first remove the regular double quotes

To remove html tags in java, you must first remove the regular double quotes

高洛峰
Release: 2017-01-22 15:01:09
Original
1071 people have browsed it

public static String htmlToStr(String htmlStr){ 
String result = ""; 
boolean flag = true; 
if(htmlStr==null){ 
return null; 
} 

htmlStr = htmlStr.replace("\"", ""); //去掉引号 

char[] a = htmlStr.toCharArray(); 
int length=a.length; 
for(int i=0;i<length;i++){ 
if(a[i]==&#39;<&#39;){ 
flag=false; 
continue; 
} 
if(a[i]==&#39;>&#39;){ 
flag=true; 
continue; 
} 
if(flag==true){ 
result+=a[i]; 
} 
} 
return result.toString(); 
}
Copy after login

For more java to remove html tags, please pay attention to the PHP Chinese website for related articles about regular expressions that must first remove double quotes!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template