You are looking for
str = str.replace(""", "\"")
DEMO
I would avoid using replaceAll
since it uses regex syntax in description of what to replace and how to replace, which means that
will have to be escaped in string "\"
but also in regex \
(needs to be written as "\\"
string) which means that we would need to use
str = str.replaceAll(""", "\\"");
or probably little cleaner:
str = str.replaceAll(""", Matcher.quoteReplacement("\""))
With replace
we have escaping mechanism added automatically.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…