aspose file tools*
The moose likes Beginning Java and the fly likes replaceAll(String oldstring, String newstring) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "replaceAll(String oldstring, String newstring)" Watch "replaceAll(String oldstring, String newstring)" New topic
Author

replaceAll(String oldstring, String newstring)

Grégoire Berclaz
Greenhorn

Joined: Feb 19, 2003
Posts: 28
Hello,
I am using JDBC and i like to insert in my MySQL DB informations but I have a probleme with "'". Because the "'" I used :
but I have every times the same error... How can I do?
Greg
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
but I have every times the same error... How can I do?
What is the error that you're experiencing?
What were you expecting myJTextField.getText().replaceAll("'", "\'"); to do?
Don't forget that Strings are immutable and, if replacements are made, the replaceAll method returns a reference to a different String object than the one the method was called on.
[ July 05, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: replaceAll(String oldstring, String newstring)