rangeUntil member operator in builtins #KT-52933
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,16 @@ public class Char private constructor(public val value: Char) : Comparable<Char>
|
||||
public operator fun rangeTo(other: Char): CharRange =
|
||||
CharRange(this, other)
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Char): CharRange =
|
||||
this until other
|
||||
|
||||
/** Returns the value of this character as a `Byte`. */
|
||||
public inline fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
Reference in New Issue
Block a user