Rama,
 From the JavaDocs:
String replace(char oldChar, char newChar)
           Returns a new string resulting from replacing all occurrences of
oldChar in this string with newChar.

It doesn't work because it replaces only characters and not Strings.   You
might want to check out the regexp project at
jakarta.apache.org.  Otherwise for simple replacement, you will need to use
String.indexOf() to break up the string and reconstruct the string with the
replaced substring.

Regards,

Richard


At 09:46 AM 12/19/2001 -0700, you wrote:
>How to replace some string in string?
>
>String x = "var1=xx&var2=yy&var3=zz"
>i want to replace yy with aa
>
>the replace function doesn't seem to work.
>
>
>Rama
>
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to