String .replace is not working in Android
android, string
Solution
Try `String s1 = s.replace("\"", "\\\"");`
Explanation: When referencing a quote or backslash in a string, i.e. anything inside double quotes, a `\` is required to state that you want the quote to appear within the quotes, not end the quotes. Does this make sense?
For example, you would write `String message = "She said \"Hello\" the other day."`, so that the backslashes represent that the quotes don't actually end the whole string, but are rather to be part of the string.
Problem
``` String s1=s.replace('"', '\"'); ``` here i want to replace `"` with `\"`