code

Common
JVM
JS
Native
1.5
inline val Char.code: Int
(source)

Returns the code of this Char.

Code of a Char is the value it was constructed with, and the UTF-16 code unit corresponding to this Char.

import java.util.*
import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val string = "0Azβ"
println(string.map { it.code }) // [48, 65, 122, 946]
//sampleEnd
}