List of utility methods to do String Quote
String | quoteJavaString(String s) Convert a string to the Java literal and enclose it with double quotes. if (s == null) { return "null"; return "\"" + javaEncode(s) + "\""; |
String | quoteJavaString(String s) Quotes a string literal for Java or JavaScript. return s == null ? "null" : "\"" + s.replaceAll("\\\\", "\\\\\\\\").replaceAll("\\\"", "\\\\\"") + "\""; |
String | quoteJsonLib(String string) from net.sf.json.util.JSONUtils char b; char c = 0; int i; int len = string.length(); StringBuffer sb = new StringBuffer(len * 2); String t; char[] chars = string.toCharArray(); char[] buffer = new char[1030]; ... |
String | quoteLiteralAsRegexp(String text) quote Literal As Regexp final int end = text.length(); StringBuilder sb = new StringBuilder(end + 8); for (int i = 0; i < end;) { char c = text.charAt(i++); switch (c) { case ' ': case '\t': while ((i < end) && text.charAt(i) <= ' ') { ... |
String | quoteLocation(String location) quote Location if (location == null) { return null; if (!location.startsWith("\"")) { location = "\"" + location; if (!location.endsWith("\"")) { location = location + "\""; ... |
String | quoteMdxIdentifier(String ident) quote Mdx Identifier return "[" + ident.replaceAll("]", "]]") + "]"; |
String | quoteMe(String unquoted) quote Me return "\"" + unquoted.replaceAll("\"", "\"\"").replaceAll("\\\\", "\\\\\\\\") + "\""; |
String | quoteMeta(String s) Quote all regular expression meta characters in s, in order to search for s literally. int i = s.length() - 1; StringBuffer bs = new StringBuffer(""); while ((i >= 0) && (s.charAt(i) == '\\')) { --i; bs.append("\\\\"); s = s.substring(0, i + 1); return "\\Q" + s.replaceAll("\\\\E", "\\\\E\\\\\\\\E\\\\Q") + "\\E" + bs.toString(); ... |
String | quotemeta(String s) quotemeta if (s == null) { throw new IllegalArgumentException("String cannot be null"); int len = s.length(); if (len == 0) { return ""; StringBuilder sb = new StringBuilder(len * 2); ... |
String | quoteMonetDbIdentifier(String ident) Quote and make the identifier MonetDB-proof by making lowercase and removing special characters. ident = prepareMonetDbIdentifier(ident); ident = "\"" + ident + "\""; return ident; |