Java String Unquote unquote(String value)

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

Description

unquote

License

Open Source License

Declaration

public static String unquote(String value) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Boeing.//ww w  .j  a va 2  s.c  o m
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/

public class Main {
    public static String unquote(String value) {
        String toReturn = value;
        if (toReturn != null) {
            int startAt = 0;
            int endAt = value.length();
            if (toReturn.startsWith("\"") || toReturn.startsWith("'")) {
                startAt = 1;
            }
            if (toReturn.endsWith("\"") || toReturn.endsWith("'")) {
                endAt = toReturn.length() - 1;
            }
            toReturn = toReturn.substring(startAt, endAt);
        }
        return toReturn;
    }
}

Related

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