Here you can find the source of htmlspecialchars(String str)
public static String htmlspecialchars(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String htmlspecialchars(String str) { str = str.replaceAll("&", "&"); str = str.replaceAll("<", "<"); str = str.replaceAll(">", ">"); str = str.replaceAll("\"", """); return str; }/*w ww . jav a2 s . com*/ }