garydgregory commented on PR #1737:
URL: https://github.com/apache/commons-lang/pull/1737#issuecomment-4847128449
> Had a look through the rest of the class. The empty-search paths in
`lastIndexOf`, `contains`, `startsWith`/`endsWith`, `equals` and the
`*Any`/`remove`/`replace` helpers all behave the same for `CI` and `CS`.
>
> The one spot left is `indexOf` with a start position past the end:
>
> `CI.indexOf("abc", "", 4)` -> `-1` `CS.indexOf("abc", "", 4)` -> `3`
>
> `CS` delegates to `String.indexOf`, which clamps the start to the length
and so keeps matching the empty search; the hand-rolled `CI` returns `-1` once
`startPos > length`. The shared prose says 'a start position greater than the
string length only matches an empty search CharSequence', which lines up with
the `CS` side. Want me to make `CI` clamp to match `CS` (and drop the
`CI.indexOf("abc", "", 9) = -1` example), or keep the documented `-1`?
@alhudz
Yeah, the reply should be consistent, regardless of case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]