Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete the last character from a string
08-18-2008, 09:08 PM
Post: #1
Delete the last character from a string
How do I remove the last character from a string? Assume that I have a String named str

str="Hello World";

I want to remove the last 'd' from str.
Find all posts by this user
Quote this message in a reply
08-18-2008, 09:24 PM
Post: #2
RE: Delete the last character from a string
Use the substring method. For eg:

[java]
str = str.substring(0, str.length() - 1);
[/java]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-19-2008, 04:28 PM
Post: #3
RE: Delete the last character from a string
Thank you.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: