With Java primitives it was easy to cast char code to symbol
int i = 65;
char c = (char) i; // 'A'
How to do the same with Kotlin?
In Smart Casting, we generally use is or !is an operator to check the type of variable, and the compiler automatically casts the variable to the target type, but in explicit type casting we use as operator. Explicit type casting can be done using : Unsafe cast operator: as.
Use the int.toChar()
function to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With