How do you remove the last charater from a string? In a loop, certain characters get added to a string. But when the loop is finished, I need to remove the last character from the string. Thanks, Mike
Mike<br />SCJP 1.4<br />----------------------------<br />mdcleary@earthlink.net<br />----------------------------<br />There are 10 types of people<br />in the world. Those that <br />understand binary, and those<br />that don't.
Here's one way String str = "Hello World+"; str = str.substring(0,str.length()-1); if you're adding a delimiter in the loop, it might be easier to add the delimiter at the beginning, then str = str.substring(1);
Michael Cleary
Ranch Hand
Joined: Jul 29, 2003
Posts: 93
posted
0
Excellent! Thank you. That is exactly what I need. I was trying to do something similar, but I can see that I wasn't close to the right syntax. Thanks again! Mike
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.