CharSequence.indexOf and friends can’t limit the range of the search.
This sucks a bit, could you please fix that with a sensible default parameter like, limitIndex:Int = length in those stdlib functions ?
real world use case : implementing a layout doing pagination for a TextView like widget for android : you want to know the index of the first ‘\n’ between position 1000 (start of a window) and say position 2000 (limit of a window) of your 100_000 chars long string (like when you want to split a paragraph inside a page into lines)
if you do indexOf(’\n’, 1000), in the case there is no ‘\n’, you’ll do a lot of useless work