fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String str = "test \"abc\" ... \"def\" end";
  9. System.out.println("before: " + str);
  10. str = str.replaceAll("\"","\\\\\"");
  11. System.out.println("after: " + str);
  12. }
  13. }
Success #stdin #stdout 0.08s 212416KB
stdin
Standard input is empty
stdout
before: test "abc" ... "def" end
after: test \"abc\" ... \"def\" end