Char
type provides toInt() method to convert a character to integer.
IntConverter.kt
fun main(args: Array<String>) { var myChar : Char = 'a' println("Value of myChar is : ${myChar}") println("Value of myChar in int is : ${myChar.toInt()}") }
Output
Value of myChar is : a Value of myChar in int is : 97
No comments:
Post a Comment