private static String trim ( String string ) { String result = string . trim ( ) ; if ( result . startsWith ( "\"" ) && result . endsWith ( "\"" ) && result . length ( ) > 1 ) { result = result . substring ( 1 , result . length ( ) - 1 ) ; } return result ; }
Remove spaces at both ends and handle double quotes .