question: public static String escape ( String unescaped ) { StringBuilder result = new StringBuilder ( ) ; for ( char c : unescaped . toCharArray ( ) ) { switch ( c ) { case '"' : result . append ( "\\\"" ) ; break ; case '\\' : result . append ( "\\\\" ) ; break ; case '\n' : result . append ( "\\n" ) ; break ; default : result . append ( c ) ; break ; } } return result . toString ( ) ; }
target:  Esacapes quotes, newlines, and backslashes. 