Here you can find the source of unquote(String literal)
Parameter | Description |
---|---|
text | the content to unquote. |
public static String unquote(String literal)
//package com.java2s; /**/*from w ww . j a va 2 s. com*/ * Converts a line of text into an array of lower case words using a * BreakIterator.wordInstance(). <p> * * This method is under the Jive Open Source Software License and was * written by Mark Imbriaco. * * @param text a String of text to convert into an array of words * @return text broken up into an array of words. */ public class Main { /** * Removes all quotes at the beginning and ending of given string. * @param text the content to unquote. * @return the unquoted version of such content. */ public static String unquote(String literal) { String result = ""; if ((literal != null) && (literal.length() > 0)) { if (literal.charAt(0) != '\"') { if (literal.charAt(0) != '\'') { result = literal; } else { if (literal.trim().length() > 0) { result = literal.substring(1, literal.length() - 1); } } } else { result = literal.substring(1, literal.length() - 1); } } return result; } }