List of utility methods to do Char Array to Entity
String | charsToEntities(String str) Converts <, >, & in the string to their HTML entity equivalents. StringBuffer buf = new StringBuffer(str.length()); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); switch (ch) { case '<': buf.append("<"); break; case '>': ... |
String | charsToEntities(String str, boolean xml11) Converts <, >, & in the string to their HTML entity equivalents. StringBuilder buf = new StringBuilder(str.length()); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (((0x00 <= ch && ch <= 0x1F) || (0x7F <= ch && ch <= 0x9F)) && ch != '\r' && ch != '\n' && ch != '\t') { if (xml11 && ch != 0x00) { buf.append("&#").append((int) ch).append(';'); } else { ... |