RFR: 8302590: Add String.indexOf(int ch, int fromIndex, int toIndex) [v2]

Viktor Klang duke at openjdk.org
Mon Feb 27 08:03:05 UTC 2023


On Fri, 24 Feb 2023 16:37:58 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Then you would also expect `string.substring(fromIndex).indexOf(ch)` to behave isomorphically to `string.indexOf(ch, fromIndex)` in current releases, right?
>> It does not.
>
> (I guess you are referring to the fact that `substring()` can throw.)

@rgiulietti That's surprising, but if it is as you say, then the indexOf with or without the endIndex should behave identically and not throw.

-------------

PR: https://git.openjdk.org/jdk/pull/12600


More information about the core-libs-dev mailing list