Java Utililty Methods String Quote

List of utility methods to do String Quote

Description

The list of methods to do String Quote are organized into topic(s).

Method

Stringquote(String string, String charsToQuote)
Quotes characters charsToQuote in string by prepending a backslash.
char[] chars = string.toCharArray();
StringBuffer result = new StringBuffer();
for (int i = 0; i < string.length(); i++) {
    if (charsToQuote.indexOf(chars[i]) != -1)
        result.append('\\');
    result.append(chars[i]);
return result.toString();
...
voidquote(String string, StringBuilder w)
Produce a string in double quotes with backslash sequences in all the right places.
if (string == null || string.length() == 0) {
    w.append("\"\"");
    return;
char b;
char c = 0;
String hhhh;
int i;
...
Stringquote(String tableName)
quote
String[] parts = tableName.split("\\.");
StringBuffer sb = new StringBuffer();
for (String part : parts) {
    sb.append("\"").append(part).append("\"").append(".");
sb.setLength(sb.length() - 1);
return sb.toString();
Stringquote(String text)
quote
StringBuffer buffer = new StringBuffer();
buffer.append(SINGLE_QUOTE);
buffer.append(text);
buffer.append(SINGLE_QUOTE);
return buffer.toString();
Stringquote(String text)
Puts a String text in quotes.
return "\"" + text + "\"";
Stringquote(String text)
quote
return "\"" + text + "\"";
Stringquote(String text)
quote
return new StringBuffer("\"").append(text).append("\"").toString(); 
Stringquote(String text)
quote
StringBuilder buf = new StringBuilder();
buf.append("\"");
for (int i = 0; i < text.length(); i++) {
    char c = text.charAt(i);
    switch (c) {
    case '\'':
        buf.append("\\'");
        break;
...
Stringquote(String text)
Quotes the provided value as a JavaScript string literal.
StringBuilder result = new StringBuilder(text.length() * 2);
result.append(APOS);
for (char ch : text.toCharArray()) {
    switch (ch) {
    case APOS:
    case QUOTE:
    case SLASH:
        result.append(SLASH);
...
Stringquote(String text, String quote)
Wraps the text in the given quote text
return quote + text + quote;