How can I get the final character in a string for a substring?

From ggc

Jump to: navigation, search

Can someone help me with the substring command? I am trying to figure out how to include the final character of a string in a substring. For instance, given the string "Hello", we start with H in position 0, and finish with o at position 4... But since the substring command does not include the final character in the parameters, entering a command like sting.substring(0,4) would return "Hell" (rather appropriate, now I think of it) Trying to finagle the code by entering string.substring(0,5) returns a "StringIndexOutOfBoundsException" error.





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter