View Single Post
  #1 (permalink)  
Old 01-02-2008, 11:35 AM
ravian ravian is offline
Senior Member
 
Join Date: Nov 2007
Posts: 115
ravian is on a distinguished road
String substring function
Hi,

I am using the substring methodto get part of a string.

Code:
String string = "WelcomeToJava"; System.out.println(string.substring(9,12));
Output:
Code:
Jav
I want to get output "Java". The index of "J" is 9 and index of a is 12. It appears that the first argument to the method is inclusive and the second one is exclusive. Please correct me.
Reply With Quote
Sponsored Links