public String dequote ( String in ) { String result = in . trim ( ) ; if ( result . charAt ( 0 ) == ' ' && result . charAt ( result . length ( ) - 1 ) == ' ' ) { return result . substring ( 1 , result . length ( ) - 1 ) ; } if ( result . charAt ( 0 ) == ' ' && result . charAt ( result . length ( ) - 1 ) == ' ' ) { return result . substring ( 1 , result . length ( ) - 1 ) ; } return result ; }
Removes single or double quotes from a quoted string . The entire string is expected to be quoted with possible leading or trailing whitespace . If the string is not quoted then it is returned unmodified .