fork download
  1. # => Define the variable with the [This's the "best" music] string
  2. message <- "This's the \"best\" music"
  3. message <-gsub("\"", "\\\"", gsub("\'", "\\\'", message, fixed=TRUE), fixed=TRUE)
  4. cat(message, sep="\n")
  5.  
  6. cat(gsub("([\"'])", "\\\\\\1", "This's the \"best\" music"), sep="\n")
Success #stdin #stdout 0.15s 175424KB
stdin
Standard input is empty
stdout
This\'s the \"best\" music
This\'s the \"best\" music