List of utility methods to do String Java Encode
String | javaEncode(String s) Convert a string to a Java literal using the correct escape sequences. int length = s.length(); StringBuilder buff = new StringBuilder(length); for (int i = 0; i < length; i++) { char c = s.charAt(i); switch (c) { case '\t': buff.append("\\t"); break; ... |
String | javaEncode(String s) java Encode StringBuffer result = new StringBuffer(); for (int i = 0; i < s.length(); i++) switch (s.charAt(i)) { case '\b': result.append("\\b"); break; case '\t': result.append("\\t"); ... |
String | javaEncode(String txt) java Encode if ((txt == null) || (txt.length() == 0)) { return txt; txt = replaceEx(txt, "\\", "\\\\"); txt = replaceEx(txt, "\r\n", "\n"); txt = replaceEx(txt, "\n", "\\n"); txt = replaceEx(txt, "\"", "\\\""); txt = replaceEx(txt, "'", "\\'"); ... |
String | javaEncode(String txt) java Encode if ((txt == null) || (txt.length() == 0)) { return txt; txt = replace(txt, "\\", "\\\\"); txt = replace(txt, "\r\n", "\n"); txt = replace(txt, "\r", "\\r"); txt = replace(txt, "\t", "\\t"); txt = replace(txt, "\n", "\\n"); ... |