• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

replace 1 char. by 2 char. in java

 
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)
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This forum is intended for questions and comments about this web site, www.javaranch.com. It is not for questions about the Java language - that's what all our other forums are for. I'm moving this to "Java in General (Intermediate)", where it has a better chance of being answered.
Also, please read our user name policy and re-register with a valid name. Thank you.
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!