File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes String replacement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "String replacement" Watch "String replacement" New topic

String replacement

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
How do we prepend all expressions in a specified list,with an excape character,in the shortest possible way.
Suppose ,we have a string - "Are+we @in /for a ? surprise"
We need an output string which looks like "Are\+we \@in \/for a \? surprise"
What is the smartest way of achieving this?
Laxmikant Ruikar

Joined: Nov 29, 2005
Posts: 23
Use regular expression pattern to replace string...

Piet Verdriet
Ranch Hand

Joined: Feb 25, 2006
Posts: 266
Here's a way:

jQuery in Action, 2nd edition
subject: String replacement