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)
inline operator fun IntRange.contains(value: Byte): Boolean(source)
inline operator fun LongRange.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)
inline operator fun LongRange.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)
inline operator fun IntRange.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)
inline operator fun IntRange.contains(value: Short): Boolean(source)
inline operator fun LongRange.contains(value: Short): Boolean(source)

Checks if the specified value belongs to this range.

Since Kotlin

1.0

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

Checks if the specified value belongs to this range.

Since Kotlin

1.9

inline operator fun UIntRange.contains(element: UInt?): Boolean(source)
inline operator fun ULongRange.contains(element: ULong?): Boolean(source)

Returns true if this range contains the specified element.

Always returns false if the element is null.

Since Kotlin

1.5

operator fun UIntRange.contains(value: UByte): Boolean(source)
operator fun ULongRange.contains(value: UByte): Boolean(source)
operator fun ULongRange.contains(value: UInt): Boolean(source)
operator fun UIntRange.contains(value: ULong): Boolean(source)
operator fun UIntRange.contains(value: UShort): Boolean(source)
operator fun ULongRange.contains(value: UShort): Boolean(source)

Checks if the specified value belongs to this range.

Since Kotlin

1.5

inline operator fun <T : Any, R : ClosedRange<T>, Iterable<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

inline operator fun <T : Any, R : OpenEndRange<T>, Iterable<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.9

@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