I've tested your theory and I seem to get 6 and not 7.
try str = str.replace('\\','/')
instead of ("\\","/")
check out java.lang.String.replace(char c, String s)

----- Original Message -----
From: "Clemente Dani" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 21, 2002 1:14 PM
Subject: String.length --- MayBe offtopic.


Hi all, maybe this can be considered as a offtopic, but As all we are
Java programmers, I think it could be interesting.


Do any of you know why the method String.length(), counts caracter
scape such "\\" as of there were two characaters? I mean:

String str = "d:\\myf"
str.length() ---> returns 7

and if you try to replace "\\" with "/" using the replace method:

str = str.replace("\\","/");

it results in str ----> "d://myf"


Any idea?

Thanks.

bye, Dani


__________________________________________________________________
 ¿Quieres conocer todo sobre el mundial?¿Quieres que lleguen los goles
de España a tu móvil?¿Quieres ganar equipaciones de la selección?
¿Quieres que suene el himno nacional en tu móvil?¿Quieres animar a la
selección y que tu mensaje lo vean miles de personas? Ahora, todo esto
y mucho más en http://mundial2002.vizzavi.es/

=========================
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