public static void quoteOnly ( Appendable buffer , String input ) { if ( input == null ) return ; try { buffer . append ( ' ' ) ; for ( int i = 0 ; i < input . length ( ) ; ++ i ) { char c = input . charAt ( i ) ; if ( c == ' ' || c == ' ' ) buffer . append ( ' ' ) ; buffer . append ( c ) ; } buffer . append ( ' ' ) ; } catch ( IOException x ) { throw new RuntimeException ( x ) ; } }
Quote a string into an Appendable . Only quotes and backslash are escaped .