Re: String.substring when beginIndex is the string's length

2015-02-18 Thread Zoltan Sziladi
Hi Claes, Thanks a lot for the clarification! I'm glad this has been optimized in JDK9! Also, your example with "foo" and "" makes sense. Thanks! Zoltan On Wed, Feb 18, 2015 at 4:51 PM, Claes Redestad wrote: > Hi Zoltan, > > 1. Well, obviously, there's an empty string at the end of all String

Re: String.substring when beginIndex is the string's length

2015-02-18 Thread Claes Redestad
Hi Zoltan, 1. Well, obviously, there's an empty string at the end of all Strings which you can index into! ;-) (I guess it was a coin toss originally. Since it'd be a bit inconsistent if say "foo".substring(0, 0) returned "" while, say, "".substring(0, 0) threw a tantrum, I'd like to think the c