How can I remove last two character of string in Java?

This is for Scala, Python, core Java, java script, Struts, Jsp, Servlet, Spring, EJB etc. Programming Language and Framework
mina1234
Posts: 72
Joined: Tue May 05, 2015 7:08 pm
Contact:

How can I remove last two character of string in Java?

Postby mina1234 » Thu Oct 01, 2015 8:08 pm

How can I remove last two character of string in Java?

e.g string = "I don't want;;"
output string = "I don't want"


sidbhatt
Posts: 54
Joined: Sun Aug 30, 2015 8:01 am
Contact:

Re: How can I remove last two character of string in Java?

Postby sidbhatt » Sat Oct 17, 2015 11:59 am

hi,

string = string.substring(0, string.length()-2);


Return to “Core Java, Scala, Python and Advanced Programming or development”

Who is online

Users browsing this forum: No registered users and 1 guest