substring

Common
JS
Native
1.3
@ExperimentalStdlibApi fun substring(startIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the length (exclusive).

Exceptions

IndexOutOfBoundsException - if startIndex is less than zero or greater than the length of this string builder.

Common
JS
1.3
@ExperimentalStdlibApi fun substring(
    startIndex: Int,
    endIndex: Int
): String
Native
1.3
fun substring(startIndex: Int, endIndex: Int): String

Returns a new String that contains characters in this string builder at startIndex (inclusive) and up to the endIndex (exclusive).

Exceptions

IndexOutOfBoundsException - or IllegalArgumentException when startIndex or endIndex is out of range of this string builder indices or when startIndex > endIndex.