Java String Unquote unquote(final String in)

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

Description

unquote

License

Open Source License

Declaration

static private String unquote(final String in) 

Method Source Code

//package com.java2s;
/*/*from www .  j av  a  2s .com*/
 * DomUI Java User Interface - shared code
 * Copyright (c) 2010 by Frits Jalvingh, Itris B.V.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * See the "sponsors" file for a list of supporters.
 *
 * The latest version of DomUI and related code, support and documentation
 * can be found at http://www.domui.org/
 * The contact for the project is Frits Jalvingh <jal@etc.to>.
 */

public class Main {
    static private String unquote(final String in) {
        String s = in.trim();
        int l = s.length();
        if (l < 2)
            return in;
        char a = s.charAt(0);
        char b = s.charAt(l - 1);
        if (a != b)
            return in;
        if (a == '\"' || a == '\'')
            return s.substring(1, l - 1);
        return in;
    }
}

Related

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