List of utility methods to do String Quote
int | quotedIndexOf(String text, int start, int limit, String setOfChars) Returns the index of the first character in a set, ignoring quoted text. for (int i = start; i < limit; ++i) { char c = text.charAt(i); if (c == BACKSLASH) { ++i; } else if (c == APOSTROPHE) { while (++i < limit && text.charAt(i) != APOSTROPHE) { } else if (setOfChars.indexOf(c) >= 0) { ... |
void | quotedJavaChar(char c, StringBuilder b) Convert character to Java-compatible source form for use in a string. switch (c) { case '\b': b.append("\\b"); break; case '\t': b.append("\\t"); break; case '\n': ... |
String | quotedName(String name) quoted Name if (name.indexOf(' ') >= 0 || name.indexOf('.') >= 0) return '"' + name + '"'; else return name; |
String | quotedName(String name) DOCUMENTME. if (name == null) return "<null>"; if ((name.indexOf(' ') >= 0) || (name.indexOf('.') >= 0) || (name.indexOf('-') >= 0)) { return '"' + name + '"'; } else { return name; |
String | quotedName(String name) quoted Name if (name.matches("\\p{Lower}\\w*")) return name; return "'" + name + "'"; |
String | quotedOrNULL(String str) quoted Or NULL return (str == null) ? "NULL" : '"' + str + '"'; |
String | quotedString(String in, boolean backslashIsEscape) quoted String StringBuilder out = new StringBuilder(); out.append('\''); if (in == null) { out.append("null"); } else { for (int i = 0; i < in.length(); i++) { char c = in.charAt(i); if (c == '\'') { ... |
String | quotedString(String str) Return a double-quoted string with inner single and double quotes escaped. if (str == null) { return null; StringBuilder sb = new StringBuilder(); sb.append("\""); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if ((ch == '\'') || (ch == '"')) { ... |
String | quotedString(String string) Returns a quoted version of the given string, if necessary. return string.length() == 0 || string.indexOf(' ') >= 0 || string.indexOf('@') >= 0 || string.indexOf('{') >= 0 || string.indexOf('}') >= 0 || string.indexOf('(') >= 0 || string.indexOf(')') >= 0 || string.indexOf(':') >= 0 || string.indexOf(';') >= 0 || string.indexOf(',') >= 0 ? ("'" + string + "'") : (string); |
String | quotedString(String text) quoted String String s = escapedDoubleQutes + text + escapedDoubleQutes;
return s;
|