Here you can find the source of unquote(String string, char quote)
Parameter | Description |
---|---|
string | a parameter |
quote | quoting character |
public static String unquote(String string, char quote)
//package com.java2s; /*/*from ww w .j av a 2 s . co m*/ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ public class Main { /** * Remove any surrounding quotes from a string * @param string * @param quote quoting character * @return udpated string */ public static String unquote(String string, char quote) { if (string.length() >= 2 && string.charAt(0) == quote && string.charAt(string.length() - 1) == quote) return string.substring(1, string.length() - 1); else return string; } }