drop

Common
JVM
JS
Native
1.0

Returns a subsequence of this char sequence with the first n characters removed.

import java.util.Locale
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
}

Exceptions

IllegalArgumentException - if n is negative.

Common
JVM
JS
Native
1.0
fun String.drop(n: Int): String
(source)

Returns a string with the first n characters removed.

import java.util.Locale
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
}

Exceptions

IllegalArgumentException - if n is negative.