dropLastWhile
Returns a subsequence of this char sequence containing all characters except last characters that satisfy the given predicate.
Since Kotlin
1.0Samples
import java.util.Locale
import kotlin.test.*
fun main() {
//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
}
Returns a string containing all characters except last characters that satisfy the given predicate.
Since Kotlin
1.0Samples
import java.util.Locale
import kotlin.test.*
fun main() {
//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
}