Write code to quote Html Special Chars
//package com.book2s; public class Main { public static void main(String[] argv) { String html = "<>book2s.com"; System.out.println(quoteHtmlSpecialChars(html)); }//ww w .j ava 2 s .c o m public static String quoteHtmlSpecialChars(String html) { if (html == null) return null; String[] specialChars = { "&", "\"", "'", "<", ">" }; String[] quoteChars = { "&", """, "'", "<", ">" }; for (int i = 0; i < specialChars.length; i++) { html = html.replace(specialChars[i], quoteChars[i]); } return html; } }