How do I convert
val hexString = "FF"
to Byte value of 255.
Doing
hexString.toInt(16).toByte()
gives -1 as result.
How do I convert
val hexString = "FF"
to Byte value of 255.
Doing
hexString.toInt(16).toByte()
gives -1 as result.
The Byte type is signed and therefore only holds values between -128 and 127.
hexString.toInt(16).toUByte()
It works ! I forgot about UByte type Thank you