contains

Common
JVM
JS
Native
1.3
operator fun IntRange.contains(element: Int?): Boolean
(source)
operator fun LongRange.contains(element: Long?): Boolean
(source)
operator fun CharRange.contains(element: Char?): Boolean
(source)
operator fun UIntRange.contains(element: UInt?): Boolean
(source)
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.

Common
JVM
JS
Native
1.0
@JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Byte
): Boolean

(source)
@JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Byte
): Boolean

(source)
@JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Byte
): Boolean

(source)
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Byte
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Byte
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Double
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Double
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Double
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Double
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Double
): Boolean

(source)
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Float
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Float
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Float
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Float
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Float
): Boolean

(source)
@JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Int
): Boolean

(source)
@JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Int
): Boolean

(source)
@JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Int
): Boolean

(source)
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Int
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Int
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Long
): Boolean

(source)
@JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Long
): Boolean

(source)
@JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Long
): Boolean

(source)
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Long
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Long
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Short
): Boolean

(source)
@JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Short
): Boolean

(source)
@JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Short
): Boolean

(source)
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Short
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4", "1.5") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Short
): Boolean

(source)
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
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.

Common
JVM
JS
Native
1.3
operator fun <T : Any, R> R.contains(
    element: T?
): Boolean where R : Iterable<T>, R : ClosedRange<T>

(source)

Returns true if this iterable range contains the specified element.

Always returns false if the element is null.