Here you can find the source of unquote(String text)
Parameter | Description |
---|---|
text | text to unquote |
public static String unquote(String text)
//package com.java2s; /*************************************************************************** * (C) Copyright 2010 - Stendhal * *************************************************************************** *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ public class Main { /**/*from w w w . j a v a2s.c om*/ * removes single and double quotes around a string * * @param text text to unquote * @return unquoted text */ public static String unquote(String text) { if ((text == null) || text.length() < 2) { return text; } if (text.charAt(0) == text.charAt(text.length() - 1)) { if (text.charAt(0) == '"' || text.charAt(0) == '\'') { return text.substring(1, text.length() - 1); } } return text; } }