Friday, December 14, 2007

Replacing the pipe "|" symbol in in a string using java

If u want to replace pipe symbol "|" in a sentence with %7C using java code .U need to write the code like this

String s="google|yahoo";
s=s.replaceAll("\\|","%7C");

Now "|" will be replaced by %7C

No comments: