package utility;

public class ReplaceHTMLChar
{
	public String replaceHTMLChar(String shtml_char){
		String dhtml_char;
		StringBuffer sb = new StringBuffer();
		
		for(int i=0; i < shtml_char.length(); i++){
			char c = shtml_char.charAt(i);
			switch (c)
			{
			 case '<' : 
			        sb.append("&lt;");
			        break;
			     case '>' : 
			        sb.append("&gt;");
			        break;
			     case '&' :
			        sb.append("&amp;");
			        break;
			     case '"' :
			        sb.append("&quot;");
			        break;
			     case '\\':
			        sb.append("&apos;");
			        break;			        
			     default:
			        sb.append(c);			
			}
		}		
		dhtml_char = sb.toString();				
		return dhtml_char;
	}
}
