Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

substring question

+3 votes
if you do a substring but only give one number, is the outcome only that character or everything AFTER that character?
asked Oct 10, 2016 in CSC 211 (F16) by Paige Oucheriah (100 points)
edited Oct 10, 2016 by Paige Oucheriah

2 Answers

+2 votes
Everything after the character
answered Oct 10, 2016 by Jack Cannell (100 points)
Yes.  If you want JUST the one character at index N, you could do:

s.substring(N,N+1)

to get the result as a one-character String ojbect, or you could do

s.charAt(N)

to get the result as a primitive char (character) data type.
+1 vote
The outcome is everything after that character
answered Oct 10, 2016 by Lucas Simon (100 points)
...