W3cubDocs

/Kotlin

slice

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.slice(indices: IntRange): CharSequence

Returns a char sequence containing characters of the original char sequence at the specified range of indices.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun String.slice(indices: IntRange): String

Returns a string containing characters of the original string at the specified range of indices.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.slice(indices: Iterable<Int>): CharSequence

Returns a char sequence containing characters of the original char sequence at specified indices.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun String.slice(indices: Iterable<Int>): String

Returns a string containing characters of the original string at specified indices.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/slice.html