Substring range inconsistency with end index


#1

I recently faced an inconsistency with the substring(IntRange)
the documentation says that endIndex is excluded but in really it is included.
I went to see the code behind with intellij and it appears that it is a shortcut to the substring(int, int) with endIndex+1.

Which one is correct? code or documentation?

Best regards,
Sylvain


#2

Looks like a documentation error, see IntRange constructor:

IntRange(start: Int, endInclusive: Int)


#3

There is no error in the documentation of each of substring overloads apart, but the way it’s presented on the documentation page with overloads could cause some confusion.

We should think how to relayout this page to make it more clear which description relate to which overload.