code

val Char.code: Int

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.

Since Kotlin

1.5

Samples

import samples.*
import java.util.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   val string = "0Azβ"
assertPrints(string.map { it.code }, "[48, 65, 122, 946]") 
   //sampleEnd
}