rangeTo
Creates a range from this value to the specified other value.
The range is inclusive of the start value and inclusive of the end value.
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