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\)".
The very handy Jakarta Commons Lang library has a string replacement routine that does not use regexps, and thus does not have the special character problem: StringUtils.replace
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.
"I'm not back." - Bill Harding, Twister
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.