dropWhile

Common
JVM
JS
Native
1.0
inline fun CharSequence.dropWhile(
    predicate: (Char) -> Boolean
): CharSequence

Returns a subsequence of this char sequence containing all characters except first characters that satisfy the given predicate.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val string = "<<<First Grade>>>"
println(string.drop(6)) // st Grade>>>
println(string.dropLast(6)) // <<<First Gr
println(string.dropWhile { !it.isLetter() }) // First Grade>>>
println(string.dropLastWhile { !it.isLetter() }) // <<<First Grade
//sampleEnd
}
Common
JVM
JS
Native
1.0
inline fun String.dropWhile(
    predicate: (Char) -> Boolean
): String

Returns a string containing all characters except first characters that satisfy the given predicate.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val string = "<<<First Grade>>>"
println(string.drop(6)) // st Grade>>>
println(string.dropLast(6)) // <<<First Gr
println(string.dropWhile { !it.isLetter() }) // First Grade>>>
println(string.dropLastWhile { !it.isLetter() }) // <<<First Grade
//sampleEnd
}