question: final String PrintVersion ( String str ) { StringBuffer buf = new StringBuffer ( str . length ( ) ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { switch ( str . charAt ( i ) ) { case '\"' : buf . append ( "\\\"" ) ; break ; case '\\' : buf . append ( "\\\\" ) ; break ; case '\t' : buf . append ( "\\t" ) ; break ; case '\n' : buf . append ( "\\n" ) ; break ; case '\f' : buf . append ( "\\f" ) ; break ; case '\r' : buf . append ( "\\r" ) ; break ; default : buf . append ( str . charAt ( i ) ) ; break ; } } ; return buf . toString ( ) ; }
target:  toString() modified 23 Aug 2007 by LL to call PrintVersion so strings   with special characters are printed properly.                          