This doesn't work:
String str = "aaabbbccc";
out.println (str.replace(''',''''));

Because ' or " are not the way to represent special charecter.
use \' and \" instead.


Shrikanth Hulisandra

vMoksha Technologies
#104, Oxford House, RusthamBagh
Airport Road, Bangalore - 560017

Tel : 5097542 / 5097545  Extn: 218

www.vmoksha.com
----- Original Message -----
From: "Barbara Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 21, 2001 12:24 AM
Subject: replacing apostrophes


> Hello All,
>
> I need to replace apostrophes from in the text a user puts in a form input
> textboxe before the text goes into the mysql database. If apostrophes go
> into the database it gets corrupted.
>
>
> I tried the "replace" function and can use it to replace a letter but am
> having trouble with the syntax to use
> to tell it to replace an  apostrophe because the function says to use
single
> quotes around the variables that you are replacing.
>
> This works:
> String str = "aaabbbccc";
> out.println (str.replace('a','b'));
>
> This doesn't work:
> String str = "aaabbbccc";
> out.println (str.replace(''',''''));
>
>
> I tried subsituting the outer single quotes with double quotes. That
doesn't
> work either.
> Any suggestions would be appreciated.
> Thanks,
> Barbara Johnson
> Instructional Applications Programmer
> [EMAIL PROTECTED]
> Northeastern Ohio Universities College of Medicine
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to