rangeUntil
Creates a range from this value up to but excluding the specified other value.
The range is inclusive of the start value and exclusive of the end value.
If the other value is less than or equal to this value, then the returned range is empty.
Since Kotlin
2.5Samples
import kotlin.text.unicode.*
import kotlin.test.*
fun main() {
//sampleStart
val rangeInclusive = 'A'.toCodePoint()..'Z'.toCodePoint()
println("'Z'.toCodePoint() in rangeInclusive is ${'Z'.toCodePoint() in rangeInclusive}") // true
println(rangeInclusive.take(5).joinToString()) // A, B, C, D, E
val rangeExclusive = CodePoint(0x1F601)..<CodePoint(0x1F60B)
println(rangeExclusive.joinToString()) // π, π, π, π, π
, π, π, π, π, π
//sampleEnd
}Content copied to clipboard