my question is quite simple:
how to replace “\” with “” ???
I tried this:
str.replaceAll("\\", "");
but I get en exception
08-04 01:14:50.146: I/LOG(7091): java.util.regex.PatternSyntaxException: Syntax error U_REGEX_BAD_ESCAPE_SEQUENCE near index 1:
It’s simpler if you don’t use
replaceAll(which takes a regex) for this – just usereplace(which takes a plain string). Don’t use the regular expression form unless you really need regexes. It just makes things more complicated.Don’t forget that just calling
replaceorreplaceAllis pointless as strings are immutable – you need to use the return result: