Java String Unquote unQuote(final String quoted)

Here you can find the source of unQuote(final String quoted)

Description

un Quote

License

Open Source License

Declaration

public static String unQuote(final String quoted) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v1.0 which accompany this distribution.
 * The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:/*w  w  w. java2  s.  com*/
 *     Jan S. Rellermeyer, IBM Research - initial API and implementation
 *******************************************************************************/

public class Main {
    public static String unQuote(final String quoted) {
        final String quoted1 = quoted.trim();
        final int len = quoted1.length();
        final int start = quoted1.charAt(0) == '"' ? 1 : 0;
        final int end = quoted1.charAt(quoted1.length() - 1) == '"' ? len - 1 : len;
        return start == 0 && end == len ? quoted : quoted1.substring(start, end);
    }
}

Related

  1. unquote(char[] ca, int pos, StringBuffer out)
  2. unquote(final CharSequence quotePhrase)
  3. unquote(final String aInput)
  4. unquote(final String in)
  5. unquote(final String s)
  6. unquote(final String str)
  7. unquote(String _path)
  8. unquote(String argument)