I feel like deprecating `Char.toInt()` is kind of ...
# getting-started
j
I feel like deprecating
Char.toInt()
is kind of a silly decision. I'm assuming it's because it's ambiguous? If I want to convert a character between
'0'
and
'9'
to its literal int value of 0-9. is the best way
myChar.code - 48
?
I think
myChar.toString().toInt()
better conveys intention.
j
Ah thanks. Makes sense that
toInt()
would be ambiguous
j
Char.digitToInt()
is the proper replacement
Yes
toInt
was ambiguous so they decided to make it more clear
👍 1