This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
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

replace 1 char. by 2 char. in java

 
satyaonline
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,
i want to pass '(apostrophy) character to the database hence,i use following code,
String mystr="let's find out what's going on";
char c='\'';
char c1='\\'+'\'';
mystr=mystr.replace(c,c1);
but above code had one problem since one character can be replaced by only one character,how can i replace in above ' by \' in above string.
Thanking you,
Hiteshonline.(satya)
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read our user name policy and re-register with a valid name. Thank you.
[This message has been edited by Jim Yingst (edited August 23, 2001).]
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[This message has been edited by David Garland (edited August 23, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic