protected String removeBracketsAndQuotes ( String text , boolean recursive , Position position ) { if ( text . length ( ) > 0 ) { char firstChar = text . charAt ( 0 ) ; switch ( firstChar ) { case ' ' : case ' ' : if ( text . charAt ( text . length ( ) - 1 ) != firstChar ) { String msg = GraphI18n . expectingValidName . text ( text , position . getLine ( ) , position . getColumn ( ) ) ; throw new ParsingException ( position , msg ) ; } String removed = text . substring ( 1 , text . length ( ) - 1 ) ; return recursive ? removeBracketsAndQuotes ( removed , recursive , position ) : removed ; case ' ' : if ( text . charAt ( text . length ( ) - 1 ) != ' ' ) { String msg = GraphI18n . expectingValidName . text ( text , position . getLine ( ) , position . getColumn ( ) ) ; throw new ParsingException ( position , msg ) ; } removed = text . substring ( 1 , text . length ( ) - 1 ) ; return recursive ? removeBracketsAndQuotes ( removed , recursive , position ) : removed ; } } return text ; }
Remove any leading and trailing single - quotes double - quotes or square brackets from the supplied text .