digitToChar

Returns the Char that represents this decimal digit. Throws an exception if this value is not in the range 0..9.

If this value is in 0..9, the decimal digit Char with code '0'.code + this is returned.

Since Kotlin

1.5

Samples


fun Int.digitToChar(radix: Int): Char(source)

Returns the Char that represents this numeric digit value in the specified radix. Throws an exception if the radix is not in the range 2..36 or if this value is not in the range 0 until radix.

If this value is less than 10, the decimal digit Char with code '0'.code + this is returned. Otherwise, the uppercase Latin letter with code 'A'.code + this - 10 is returned.

Since Kotlin

1.5

Samples