I need to escape all quotes (\') in a string, so it becomes \\\'
I\'ve tried using replaceAll, but it doesn\'t do anything. For some reason I can\'t get the regex to
You can use apache's commons-text library (instead of commons-lang):
Example code:
org.apache.commons.text.StringEscapeUtils.escapeJava(escapedString);
Dependency:
compile 'org.apache.commons:commons-text:1.8' OR org.apache.commons commons-text 1.8