dropWhile

inline fun CharSequence.dropWhile(predicate: (Char) -> Boolean): CharSequence(source)

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

Since Kotlin

1.0

Samples

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
}

inline fun String.dropWhile(predicate: (Char) -> Boolean): String(source)

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

Since Kotlin

1.0

Samples

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
}