hi, I have to replace all occurances of "." in a String with another character. Problem is replace and replaceAll methods expect regex. But "." has different meaning in regex. Also I cannot use an escape sequence as \. is not a valid escape sequence. Currently I'm doing it in the crudest way possible ( using char). Is there any simpler way of doing this.
Nirmal Kumar<br />If you have to aim, aim for the moon. Even if you miss you will land among the stars
First of all, Strings are immutable, so the String referenced by str is not changed. replaceAll returns a new String. Secondly, '\' is a special character in both regex and Java strings, so you need to escape the '\'s as well. Try
[ March 26, 2007: Message edited by: Joanne Neal ]