How to get the numeric value of a digit (0-9)?


#1

did i miss a method/function, or is the only way char.toInt - 48


#2

There's no such function in the library yet. Feel free to contribute


#3

the method to call would be Character.getNumericValue that already exists should i google for "kotlin contributon" and create a pull request?


#4

You can call Character.getNumericValue() directly from Kotlin, and a pull request is welcome too


#5

yes i can, but i am super lazy and want to write '5'.n<code completion> and intellij should complete it to '5'.toNumericValue()

which should be an extention function that calls character.getnumericvalue. i’ll try to create a pull request when i have time, and will engrave my name into the glorious history of kotlin


#6

Did this great idea bear any fruit?