Mark
05/30/2022, 1:03 AM[0-9]
?
1️⃣ Int
2️⃣ UInt
3️⃣ Byte
4️⃣ Short
5️⃣ value class of Int
6️⃣ value class of UInt
7️⃣ value class of Byte
8️⃣ value class of Short
9️⃣ value class of Char
I suppose we already have the Kotlin answer, which is Char.digitToInt(): Int
Chris Lee
05/30/2022, 1:12 AMChar
; if it is truly a number (escape code, binary protocol, etc) then Byte
may be a better choice. All depends on what it represents and how it will be used.Mark
05/30/2022, 1:17 AMephemient
05/30/2022, 1:18 AMRuckus
05/30/2022, 4:18 AMList<Digit>
Joffrey
05/30/2022, 7:45 AMByte
is also a good optionephemient
05/30/2022, 8:13 AMvalue class Digit(digit: Byte)
and a value class Digit(digit: Int)
)value enum class
in the future, to combine the benefits of enum class
(bounded values) with a value class
(primitive representation), but for now there's just different trade-offsMark
05/30/2022, 9:24 AMvalue enum class
would make sense for my use case, but as it is enum class
feels like overkill.