Java Utililty Methods String Quote

List of utility methods to do String Quote

  1. HOME
  2. Java
  3. S
  4. String Quote

Description

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

Method

String quote(CharSequence cs)
Quotes the given string as Java string literal style, and returns it.
StringBuilder buf = new StringBuilder();
quoteTo(cs, buf);
return buf.toString();
String quote(CharSequence str)
quote
if (str == null)
 return "null";
int len = str.length();
StringBuilder buf = new StringBuilder(len + 10);
buf.append("\"");
for (int i = 0; i < len; i++) {
 char c = str.charAt(i);
 switch (c) {
...
String quote(CharSequence value)
quote
StringBuilder builder = new StringBuilder(value.length() + 2);
builder.append('"');
for (int i = 0; i < value.length(); i++) {
 char c = value.charAt(i);
 switch (c) {
 case '"':
 builder.append("\\\"");
 break;
...
CharSequence quote(final CharSequence original)
quote
final StringBuilder buff = builder().append('"');
final int len = original.length();
for (int i = 0; i < len; i++) {
 final char c = original.charAt(i);
 if (c == '"' || c == '#') {
 buff.append('#');
 buff.append(c);
...
CharSequence quote(final CharSequence phrase)
Quote the phrase from the given quote character.
int length = phrase.length();
final StringBuilder builder = new StringBuilder();
builder.append('"');
char ch = '0円';
for (int index = 0; index < length; index++) {
 ch = phrase.charAt(index);
 if (ch == '\\') {
 builder.append("\\\\").append('\\').append(phrase.charAt(++index));
...
String quote(final String s)
quote
if (s.startsWith("'")) {
 return s;
return "'" + s + "'";
String quote(final String str)
quote
return (str == null || str.length() == 0 || (str.charAt(0) == '`' && str.charAt(str.length() - 1) == '`'))
 ? str
 : new StringBuilder(str.length() + 2).append('`').append(str).append('`').toString();
String quote(final String str)
quote
return QUOTE + str + QUOTE;
String quote(final String str)
quote
return "\"" + str + "\"";
String quote(final String sValue)
quote
if (sValue == null)
 return sValue;
else
 return "'" + sValue + "'";


AltStyle によって変換されたページ (->オリジナル) /