You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
612 B

package com.util;
/**
*
* HTML<EFBFBD><EFBFBD><EFBFBD>Ź<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @author Administrator
*
*/
public final class Filter {
public Filter(){
}
public static String escapeHTMLTags( String input ) {
if( input == null || input.length() == 0 ) {
return input;
}
StringBuffer buf = new StringBuffer();
char ch = ' ';
for( int i=0; i<input.length(); i++ ) {
ch = input.charAt(i);
if( ch == '<' ) {
buf.append( "&lt;" );
}
else if( ch == '>' ) {
buf.append( "&gt;" );
}
else if(ch=='&'){
buf.append("&amp;");
}
else {
buf.append( ch );
}
}
return buf.toString();
}
}