contains

inline operator fun IntRange.contains(element: Int?): Boolean(source)
inline operator fun LongRange.contains(element: Long?): Boolean(source)
inline operator fun CharRange.contains(element: Char?): Boolean(source)

Returns true if this range contains the specified element.

Always returns false if the element is null.

Since Kotlin

1.3

@JvmName(name = "intRangeContains")
operator fun ClosedRange<Int>.contains(value: Byte): Boolean(source)
@JvmName(name = "longRangeContains")
operator fun ClosedRange<Long>.contains(value: Byte): Boolean(source)
@JvmName(name = "shortRangeContains")
operator fun ClosedRange<Short>.contains(value: Byte): Boolean(source)
@JvmName(name = "floatRangeContains")
operator fun ClosedRange<Float>.contains(value: Double): Boolean(source)
@JvmName(name = "doubleRangeContains")
operator fun ClosedRange<Double>.contains(value: Float): Boolean(source)
@JvmName(name = "longRangeContains")
operator fun ClosedRange<Long>.contains(value: Int): Boolean(source)
@JvmName(name = "byteRangeContains")
operator fun ClosedRange<Byte>.contains(value: Int): Boolean(source)
@JvmName(name = "shortRangeContains")
operator fun ClosedRange<Short>.contains(value: Int): Boolean(source)
@JvmName(name = "intRangeContains")
operator fun ClosedRange<Int>.contains(value: Long): Boolean(source)
@JvmName(name = "byteRangeContains")
operator fun ClosedRange<Byte>.contains(value: Long): Boolean(source)
@JvmName(name = "shortRangeContains")
operator fun ClosedRange<Short>.contains(value: Long): Boolean(source)
@JvmName(name = "intRangeContains")
operator fun ClosedRange<Int>.contains(value: Short): Boolean(source)
@JvmName(name = "longRangeContains")
operator fun ClosedRange<Long>.contains(value: Short): Boolean(source)
@JvmName(name = "byteRangeContains")
operator fun ClosedRange<Byte>.contains(value: Short): Boolean(source)

Checks if the specified value belongs to this range.

Since Kotlin

1.0

inline operator fun <T : Any, R : Iterable<T>, ClosedRange<T>> R.contains(element: T?): Boolean(source)

Returns true if this iterable range contains the specified element.

Always returns false if the element is null.

Since Kotlin

1.3

@JvmName(name = "doubleRangeContains")
operator fun ClosedRange<Double>.contains(value: Byte): Boolean(source)
@JvmName(name = "floatRangeContains")
operator fun ClosedRange<Float>.contains(value: Byte): Boolean(source)
@JvmName(name = "intRangeContains")
operator fun ClosedRange<Int>.contains(value: Double): Boolean(source)
@JvmName(name = "longRangeContains")
operator fun ClosedRange<Long>.contains(value: Double): Boolean(source)
@JvmName(name = "byteRangeContains")
operator fun ClosedRange<Byte>.contains(value: Double): Boolean(source)
@JvmName(name = "shortRangeContains")
operator fun ClosedRange<Short>.contains(value: Double): Boolean(source)
@JvmName(name = "intRangeContains")
operator fun ClosedRange<Int>.contains(value: Float): Boolean(source)
@JvmName(name = "longRangeContains")
operator fun ClosedRange<Long>.contains(value: Float): Boolean(source)
@JvmName(name = "byteRangeContains")
operator fun ClosedRange<Byte>.contains(value: Float): Boolean(source)
@JvmName(name = "shortRangeContains")
operator fun ClosedRange<Short>.contains(value: Float): Boolean(source)
@JvmName(name = "doubleRangeContains")
operator fun ClosedRange<Double>.contains(value: Int): Boolean(source)
@JvmName(name = "floatRangeContains")
operator fun ClosedRange<Float>.contains(value: Int): Boolean(source)
@JvmName(name = "doubleRangeContains")
operator fun ClosedRange<Double>.contains(value: Long): Boolean(source)
@JvmName(name = "floatRangeContains")
operator fun ClosedRange<Float>.contains(value: Long): Boolean(source)
@JvmName(name = "doubleRangeContains")
operator fun ClosedRange<Double>.contains(value: Short): Boolean(source)
@JvmName(name = "floatRangeContains")
operator fun ClosedRange<Float>.contains(value: Short): Boolean(source)

Deprecated

Warning since 1.3

Error since 1.4

Hidden since 1.5

This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.

Checks if the specified value belongs to this range.

Since Kotlin

1.0