Here you can find the source of dequoteString(String str)
Parameter | Description |
---|---|
str | string to dequote |
public static String dequoteString(String str)
//package com.java2s; // Distributed under the OSI-approved BSD 3-Clause License. public class Main { /**//from w w w. j a va2s . c o m * Removes matched quotes (single or double) from a string. Quotes are only removed from the first and last * characters of the string. * * @param str string to dequote * @return the dequoted string or the original string, if no changes were made */ public static String dequoteString(String str) { if (str != null && str.length() > 1 && ((str.charAt(0) == '"' || str.charAt(0) == '\'') && str.charAt(str.length() - 1) == str.charAt(0))) { return str.substring(1, str.length() - 1); } return str; } }