get

operator fun String.get(indices: IntRange): String

Returns the substring from the given range.

Example:

val mainStr = "Interesting"
val str = mainStr[2..8] // "teresti"

Since

1.1.0

See also

substring
IntRange

Throws

if the range is out of bounds of this string.


operator fun String.get(indices: IntProgression): String

Returns the substring from the given progression.

Example:

val mainStr = "Interesting"
val str = mainStr[2..8 step 2] // "trsi"

Since

1.1.0

See also

substring
IntProgression

Throws

if the range is out of bounds of this string.