W3cubDocs

/Kotlin

contains

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
operator fun IntRange.contains(element: Int?): Boolean
operator fun LongRange.contains(element: Long?): Boolean
operator fun CharRange.contains(element: Char?): Boolean
@ExperimentalUnsignedTypes operator fun UIntRange.contains(
    element: UInt?
): Boolean
@ExperimentalUnsignedTypes operator fun ULongRange.contains(
    element: ULong?
): Boolean

Returns true if this range contains the specified element.

Always returns false if the element is null.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
@JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Byte
): Boolean
@JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Byte
): Boolean
@JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Byte
): Boolean
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Byte
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Byte
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Double
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Double
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Double
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Double
): Boolean
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
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("intRangeContains") operator fun ClosedRange<Int>.contains(
    value: Float
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Float
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Float
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Float
): Boolean
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
@JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Int
): Boolean
@JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Int
): Boolean
@JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Int
): Boolean
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Int
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Int
): Boolean
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
@JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Long
): Boolean
@JvmName("shortRangeContains") operator fun ClosedRange<Short>.contains(
    value: Long
): Boolean
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Long
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Long
): Boolean
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
@JvmName("longRangeContains") operator fun ClosedRange<Long>.contains(
    value: Short
): Boolean
@JvmName("byteRangeContains") operator fun ClosedRange<Byte>.contains(
    value: Short
): Boolean
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("doubleRangeContains") operator fun ClosedRange<Double>.contains(
    value: Short
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@DeprecatedSinceKotlin("1.3", "1.4") @JvmName("floatRangeContains") operator fun ClosedRange<Float>.contains(
    value: Short
): Boolean
Deprecated: This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.
@ExperimentalUnsignedTypes operator fun UIntRange.contains(
    value: UByte
): Boolean
@ExperimentalUnsignedTypes operator fun ULongRange.contains(
    value: UByte
): Boolean
@ExperimentalUnsignedTypes operator fun ULongRange.contains(
    value: UInt
): Boolean
@ExperimentalUnsignedTypes operator fun UIntRange.contains(
    value: ULong
): Boolean
@ExperimentalUnsignedTypes operator fun UIntRange.contains(
    value: UShort
): Boolean
@ExperimentalUnsignedTypes operator fun ULongRange.contains(
    value: UShort
): Boolean

Checks if the specified value belongs to this range.

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

Returns true if this iterable range contains the specified element.

Always returns false if the element is null.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/contains.html