I need to replace single quotes. However, I cannot use the "
double quote character. Therefore, I cannot do something like this:
String s = "Hello 'thanks' bye";
s = s.replaceAll("'", "\\'");
System.out.println(s);
// Hello \'thanks\' bye
I need to replace the single quotes in str
with \'
, that is, when I print str
I should get an output of Hello \'thanks\' bye
. Without using double quotes, how do I achieve this with Apex?