I need to remove some substrings in strings (in a large dataset). The substrings often contain special characters, like these: ., ^, /,... and replaceAll() would treat them as s
Is there other functions to do the "replace"
Yes, it is called replace :) Main difference between it and replaceAll is that it escapes regex special characters.
BTW if you want to escape regex's special characters in string you can
yourString = Pattern.quote(yourString)
,"\\Q"
and "\\E"
, to escape only some special characters you can
"\\"
before them like \\.
"["
and "]"
like [.]
.