static String stringLiteralWithDoubleQuotes(String value, String indent) {
    StringBuilder result = new StringBuilder(value.length() + 2);
    result.append('"');
    for (int i = 0; i < value.length(); i++) {
      char c = value.charAt(i);
      // trivial case: single quote must not be escaped
      if (c == '\'') {
        result.append("'");
        continue;
      }
      // trivial case: double quotes must be escaped
      if (c == '\"') {
        result.append("\\\"");
        continue;
      }
      // default case: just let character literal do its work
      result.append(characterLiteralWithoutSingleQuotes(c));
      // need to append indent after linefeed?
      if (c == '\n' && i + 1 < value.length()) {
        result.append("\"\n").append(indent).append(indent).append("+ \"");
      }
    }
    result.append('"');
    return result.toString();
  }
static String stringLiteralWithDoubleQuotes ( String value , String indent ) { StringBuilder result = new StringBuilder ( value . length ( ) + 2 ) ; result . append ( '"' ) ; for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char c = value . charAt ( i ) ; if ( c == '\'' ) { result . append ( "'" ) ; continue ; } if ( c == '\"' ) { result . append ( "\\\"" ) ; continue ; } result . append ( characterLiteralWithoutSingleQuotes ( c ) ) ; if ( c == '\n' && i + 1 < value . length ( ) ) { result . append ( "\"\n" ) . append ( indent ) . append ( indent ) . append ( "+ \"" ) ; } } result . append ( '"' ) ; return result . toString ( ) ; }
Returns the string literal representing {@code value}, including wrapping double quotes.