can somebody tell which is the simpliest way to to escape chars in a String? Lets say i found "(si)" and want to replace it by something diffrent. But the String.replaceAll uses regex, so it will find "si" as a group. In short i need the String "(si)" translated to "\(si\)".
If you're using JDK 5 or greater, you can use String's replace(CharSequence, CharSequence) method. While replaceFirst(String, String) and replaceAll(String, String) both use regex, replace(char, char) and replace(CharSequence, CharSequence) do not.