Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String replacement

 
Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use regular expression pattern to replace string...


LDR.
 
Piet Verdriet
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a way:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic