rangeUntil

Common
JVM
JS
Native
1.7
@ExperimentalStdlibApi operator fun Int.rangeUntil(
    to: Byte
): IntRange

(source)
@ExperimentalStdlibApi operator fun Long.rangeUntil(
    to: Byte
): LongRange

(source)
@ExperimentalStdlibApi operator fun Byte.rangeUntil(
    to: Byte
): IntRange

(source)
@ExperimentalStdlibApi operator fun Short.rangeUntil(
    to: Byte
): IntRange

(source)
@ExperimentalStdlibApi operator fun Char.rangeUntil(
    to: Char
): CharRange

(source)
@ExperimentalStdlibApi operator fun Int.rangeUntil(
    to: Int
): IntRange

(source)
@ExperimentalStdlibApi operator fun Long.rangeUntil(
    to: Int
): LongRange

(source)
@ExperimentalStdlibApi operator fun Byte.rangeUntil(
    to: Int
): IntRange

(source)
@ExperimentalStdlibApi operator fun Short.rangeUntil(
    to: Int
): IntRange

(source)
@ExperimentalStdlibApi operator fun Int.rangeUntil(
    to: Long
): LongRange

(source)
@ExperimentalStdlibApi operator fun Long.rangeUntil(
    to: Long
): LongRange

(source)
@ExperimentalStdlibApi operator fun Byte.rangeUntil(
    to: Long
): LongRange

(source)
@ExperimentalStdlibApi operator fun Short.rangeUntil(
    to: Long
): LongRange

(source)
@ExperimentalStdlibApi operator fun Int.rangeUntil(
    to: Short
): IntRange

(source)
@ExperimentalStdlibApi operator fun Long.rangeUntil(
    to: Short
): LongRange

(source)
@ExperimentalStdlibApi operator fun Byte.rangeUntil(
    to: Short
): IntRange

(source)
@ExperimentalStdlibApi operator fun Short.rangeUntil(
    to: Short
): IntRange

(source)
@ExperimentalStdlibApi operator fun UByte.rangeUntil(
    to: UByte
): UIntRange

(source)
@ExperimentalStdlibApi operator fun UInt.rangeUntil(
    to: UInt
): UIntRange

(source)
@ExperimentalStdlibApi operator fun ULong.rangeUntil(
    to: ULong
): ULongRange

(source)
@ExperimentalStdlibApi operator fun UShort.rangeUntil(
    to: UShort
): UIntRange

(source)

Returns a range from this value up to but excluding the specified to value.

If the to value is less than or equal to this value, then the returned range is empty.

Common
JVM
JS
Native
1.7
@ExperimentalStdlibApi operator fun <T : Comparable<T>> T.rangeUntil(
    that: T
): OpenEndRange<T>

(source)

Creates an open-ended range from this Comparable value to the specified that value.

This value needs to be smaller than that value, otherwise the returned range will be empty.

import java.sql.Date
import kotlin.test.assertFalse
import kotlin.test.assertTrue

fun main(args: Array<String>) {
//sampleStart
val start = Date.valueOf("2017-01-01")
val end = Date.valueOf("2017-12-31")
val range = start..end
println(range) // 2017-01-01..2017-12-31

println("Date.valueOf(\"2017-05-27\") in range is ${Date.valueOf("2017-05-27") in range}") // true
println("Date.valueOf(\"2018-01-01\") in range is ${Date.valueOf("2018-01-01") in range}") // false
println("Date.valueOf(\"2018-01-01\") !in range is ${Date.valueOf("2018-01-01") !in range}") // true
//sampleEnd
}
Common
JVM
JS
Native
1.7
@ExperimentalStdlibApi operator fun Double.rangeUntil(
    that: Double
): OpenEndRange<Double>

(source)

Creates an open-ended range from this Double value to the specified that value.

Numbers are compared with the ends of this range according to IEEE-754.

Common
JVM
JS
Native
1.7
@ExperimentalStdlibApi operator fun Float.rangeUntil(
    that: Float
): OpenEndRange<Float>

(source)

Creates an open-ended range from this Float value to the specified that value.

Numbers are compared with the ends of this range according to IEEE-754.