Java String Unquote unquote(final String str)

Here you can find the source of unquote(final String str)

Description

unquote

License

Apache License

Declaration

static String unquote(final String str) 

Method Source Code

//package com.java2s;
/**/*from  ww w.jav  a  2  s  .  c  o  m*/
 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
 *   This file is part of the LDP4j Project:
 *     http://www.ldp4j.org/
 *
 *   Center for Open Middleware
 *     http://www.centeropenmiddleware.com/
 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
 *   Copyright (C) 2014-2016 Center for Open Middleware.
 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *             http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
 *   Artifact    : org.ldp4j.commons:ldp4j-commons-http:0.2.1
 *   Bundle      : ldp4j-commons-http-0.2.1.jar
 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
 */

public class Main {
    private static final char DQUOTE = '\"';

    static String unquote(final String str) {
        return isQuotedString(str) ? str.substring(1, str.length() - 1) : str;
    }

    static boolean isQuotedString(final String str) {
        boolean result = false;
        final int length = str.length();
        if (length > 1) {
            result = str.charAt(0) == DQUOTE && str.charAt(length - 1) == DQUOTE;
        }
        return result;
    }
}

Related

  1. unquote(final CharSequence quotePhrase)
  2. unquote(final String aInput)
  3. unquote(final String in)
  4. unQuote(final String quoted)
  5. unquote(final String s)
  6. unquote(String _path)
  7. unquote(String argument)
  8. unquote(String argument)
  9. unquote(String aString)