W3cubDocs

/Kotlin

Char

class Char : Comparable<Char>

Represents a 16-bit Unicode character. On the JVM, non-nullable values of this type are represented as values of the primitive type char.

Functions

compareTo

fun compareTo(other: Char): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

dec

operator fun dec(): Char

Decrements this value.

inc

operator fun inc(): Char

Increments this value.

minus

operator fun minus(other: Char): Int

Subtracts the other Char value from this value resulting an Int.

operator fun minus(other: Int): Char

Subtracts the other Int value from this value resulting a Char.

plus

operator fun plus(other: Int): Char

Adds the other Int value to this value resulting a Char.

rangeTo

operator fun rangeTo(other: Char): CharRange

Creates a range from this value to the specified other value.

toByte

fun toByte(): Byte

Returns the value of this character as a Byte.

toChar

fun toChar(): Char

Returns the value of this character as a Char.

toDouble

fun toDouble(): Double

Returns the value of this character as a Double.

toFloat

fun toFloat(): Float

Returns the value of this character as a Float.

toInt

fun toInt(): Int

Returns the value of this character as a Int.

toLong

fun toLong(): Long

Returns the value of this character as a Long.

toShort

fun toShort(): Short

Returns the value of this character as a Short.

Companion Object Properties

MAX_HIGH_SURROGATE

const val MAX_HIGH_SURROGATE: Char

The maximum value of a Unicode high-surrogate code unit.

MAX_LOW_SURROGATE

const val MAX_LOW_SURROGATE: Char

The maximum value of a Unicode low-surrogate code unit.

MAX_SURROGATE

const val MAX_SURROGATE: Char

The maximum value of a Unicode surrogate code unit.

MIN_HIGH_SURROGATE

const val MIN_HIGH_SURROGATE: Char

The minimum value of a Unicode high-surrogate code unit.

MIN_LOW_SURROGATE

const val MIN_LOW_SURROGATE: Char

The minimum value of a Unicode low-surrogate code unit.

MIN_SURROGATE

const val MIN_SURROGATE: Char

The minimum value of a Unicode surrogate code unit.

Extension Properties

category

val Char.category: CharCategory

Returns a value indicating a character's general category.

directionality

val Char.directionality: CharDirectionality

Returns the Unicode directionality property for the given character.

Extension Functions

downTo

infix fun Char.downTo(to: Char): CharProgression

Returns a progression from this value down to the specified to value with the step -1.

equals

fun Char.equals(
    other: Char, 
    ignoreCase: Boolean = false
): Boolean

Returns true if this character is equal to the other character, optionally ignoring character case.

isDefined

fun Char.isDefined(): Boolean

Returns true if this character (Unicode code point) is defined in Unicode.

isDigit

fun Char.isDigit(): Boolean

Returns true if this character (Unicode code point) is a digit.

isHighSurrogate

fun Char.isHighSurrogate(): Boolean

Returns true if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

isISOControl

fun Char.isISOControl(): Boolean

Returns true if this character is an ISO control character.

isIdentifierIgnorable

fun Char.isIdentifierIgnorable(): Boolean

Returns true if this character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

isJavaIdentifierPart

fun Char.isJavaIdentifierPart(): Boolean

Returns true if this character (Unicode code point) may be part of a Java identifier as other than the first character.

isJavaIdentifierStart

fun Char.isJavaIdentifierStart(): Boolean

Returns true if this character is permissible as the first character in a Java identifier.

isLetter

fun Char.isLetter(): Boolean

Returns true if this character is a letter.

isLetterOrDigit

fun Char.isLetterOrDigit(): Boolean

Returns true if this character is a letter or digit.

isLowSurrogate

fun Char.isLowSurrogate(): Boolean

Returns true if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

isLowerCase

fun Char.isLowerCase(): Boolean

Returns true if this character is lower case.

isSurrogate

fun Char.isSurrogate(): Boolean

Returns true if this character is a Unicode surrogate code unit.

isTitleCase

fun Char.isTitleCase(): Boolean

Returns true if this character is a titlecase character.

isUpperCase

fun Char.isUpperCase(): Boolean

Returns true if this character is upper case.

isWhitespace

fun Char.isWhitespace(): Boolean

Determines whether a character is whitespace according to the Unicode standard. Returns true if the character is whitespace.

plus

operator fun Char.plus(other: String): String

Concatenates this Char and a String.

toLowerCase

fun Char.toLowerCase(): Char

Converts this character to lowercase.

toTitleCase

fun Char.toTitleCase(): Char

Converts this character to titlecase.

toUpperCase

fun Char.toUpperCase(): Char

Converts this character to uppercase.

until

infix fun Char.until(to: Char): CharRange

Returns a range from this value up to but excluding the specified to value.

© 2010–2018 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html