Here you can find the source of dequote(String str)
Parameter | Description |
---|---|
str | the string to remove surrounding quotes from |
public static String dequote(String str)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 public class Main { /**/*from w w w. java 2 s .co m*/ * Remove quotes from a string, only if the input string start with and end with the same quote character. * * @param str * the string to remove surrounding quotes from * @return the de-quoted string */ public static String dequote(String str) { char start = str.charAt(0); if ((start == '\'') || (start == '\"')) { // possibly quoted char end = str.charAt(str.length() - 1); if (start == end) { // dequote return str.substring(1, str.length() - 1); } } return str; } }