Java String Unquote unquote(String value)

Here you can find the source of unquote(String value)

Description

unquote

License

Apache License

Declaration

public static String unquote(String value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String unquote(String value) {
        if (value.startsWith("\"") && value.endsWith("\"")) {
            return pinch(value, 1);
        } else if (value.startsWith("'") && value.endsWith("'")) {
            return pinch(value, 1);
        } else {//from  w w w.java 2s . com
            return value;
        }

    }

    /**
     * Take a number of chars from the start and end and return the middle string
     *
     * @param string
     * @param i
     * @return
     */
    public static String pinch(String string, int chars) {
        return string.substring(chars, string.length() - chars);
    }
}

Related

  1. unquote(String value)
  2. unquote(String value)
  3. unquote(String value)
  4. UnQuote(String value)
  5. unquote(String value)
  6. unquote(String value)
  7. unquoteAtom(String atom)
  8. unquoteCharacterLiteral(String charLiteralStr)
  9. unquoteCString(String str)