java question

Posted by: image

java question - 15/09/2004 22:56

i'm trying to clean up some dirty data input before passing it on to another method.

the string in question is say, String s = "ST. JOHN%27%27S";

obviously, the %27%27 is actually supposed to be a '

but unfurtunately, s.replaceAll( "%27%27", "'");

no errors happen, but java doesn't seem to see that the pattern is in front of it's face. so, ultimately, i never get the desired effect. any suggestions?
Posted by: mcomb

Re: java question - 15/09/2004 23:47

String.replaceAll() returns a modified copy of the String rather than doing an in place transformation so you need to do...

s = s.replaceAll( "%27%27", "'");

-Mike
Posted by: image

Re: java question - 16/09/2004 00:30

yeah, i was doing that. it turned out to be a routine AFTER i had read the cityname in that was adding the extra chars. duh. thanks for the help.
Posted by: Cybjorg

Re: java question - 16/09/2004 10:11

Doh! I thought this thread was about coffee.