Java String Unquote unquoteString(final String input)

Here you can find the source of unquoteString(final String input)

Description

Removes quotes from a string.

License

Creative Commons License

Parameter

Parameter Description
input string to edit

Exception

Parameter Description
IllegalArgumentException if String is null

Return

a string with quotes removed

Declaration

public static String unquoteString(final String input) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    /**/* w  w  w. j ava 2  s .  com*/
     * Removes quotes from a string.
     * @param input string to edit
     * @return a string with quotes removed
     * @throws IllegalArgumentException if String is null
     */
    public static String unquoteString(final String input) {
        if (input == null)
            throw new IllegalArgumentException("String cannot be null!");
        return input.startsWith("\"") && input.endsWith("\"") || input.startsWith("'") && input.endsWith("'")
                ? input.substring(1, input.length() - 1)
                : input;

    }
}

Related

  1. unQuoteIdentifier(String identifier, String quoteChar)
  2. unQuoteIdentifier(String identifier, String quoteChar)
  3. unquoteImpl(String s, char delim)
  4. unquotePath(String path)
  5. unquoteS(String s)
  6. unquoteString(String s)
  7. unquoteString(String s)
  8. unquoteString(String s)
  9. unquoteString(String value)