Char

A single unsigned 16-bit UTF-16 code unit.

Values range from U+0000 through U+FFFF, including surrogate code units. A supplementary Unicode character requires two Char values in a string. Operations returning Char wrap modulo 65,536; code exposes the code unit as a non-negative Int.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
external val code: Int

The unsigned UTF-16 code-unit value, in the range 0 through 65,535.

Functions

Link copied to clipboard
open operator external override fun compareTo(other: Char): Int

Compares UTF-16 code units numerically.

Link copied to clipboard
operator external fun dec(): Char

Returns the previous UTF-16 code unit.

Link copied to clipboard
infix fun Char.downTo(other: Char): CharProgression

Creates a descending progression from this value down to other, inclusive.

Link copied to clipboard
operator external fun inc(): Char

Returns the next UTF-16 code unit.

Link copied to clipboard

Returns whether this UTF-16 character is Kotlin whitespace.

Link copied to clipboard
operator external fun minus(other: Char): Int

Returns the signed distance between two UTF-16 code units.

operator external fun minus(other: Int): Char

Subtracts other from this UTF-16 code unit.

Link copied to clipboard
operator external fun plus(other: Int): Char

Adds other to this UTF-16 code unit.

Link copied to clipboard
operator fun Char.rangeTo(other: Char): CharRange

Creates an ascending range from this value up to other, inclusive.

Link copied to clipboard
operator fun Char.rangeUntil(other: Char): CharRange

Creates an ascending range from this value up to other, exclusive.

Link copied to clipboard
external fun toInt(): Int

Returns this UTF-16 code unit as an Int.

Link copied to clipboard
infix fun Char.until(other: Char): CharRange

Creates an ascending range from this value up to other, exclusive.