private String escapeQuotes ( String value ) { StringBuilder sb = new StringBuilder ( ) ; int length = value . length ( ) ; char c ; sb . append ( ' ' ) ; for ( int index = 0 ; index < length ; index ++ ) { c = value . charAt ( index ) ; sb . append ( c ) ; if ( c == ' ' ) { sb . append ( ' ' ) ; } } sb . append ( ' ' ) ; return ( sb . toString ( ) ) ; }
This method is called when double quotes are found as part of a value . The quotes are escaped by adding a second quote character and the entire value is quoted .