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

**URL:** <https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717>\
**Category:** Uncategorized\
**Created:** [October 28, 2013, 12:14am UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717 "2013-10-28T00:14:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![HamsterofDeath](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@HamsterofDeath](https://discuss.kotlinlang.org/u/HamsterofDeath)\
**Post date:** [October 28, 2013, 12:14am UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717/1 "2013-10-28T00:14:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [October 28, 2013, 7:20am UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717/2 "2013-10-28T07:20:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HamsterofDeath](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@HamsterofDeath](https://discuss.kotlinlang.org/u/HamsterofDeath)\
**Post date:** [October 28, 2013, 2:05pm UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717/3 "2013-10-28T14:05:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [October 28, 2013, 2:25pm UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717/4 "2013-10-28T14:25:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HamsterofDeath](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@HamsterofDeath](https://discuss.kotlinlang.org/u/HamsterofDeath)\
**Post date:** [October 28, 2013, 2:28pm UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717/5 "2013-10-28T14:28:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sankeman2004](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sankeman2004](https://discuss.kotlinlang.org/u/sankeman2004)\
**Post date:** [September 17, 2017, 10:12pm UTC](https://discuss.kotlinlang.org/t/how-to-get-the-numeric-value-of-a-digit-0-9/717/6 "2017-09-17T22:12:18Z")

</div>

Did this great idea bear any fruit?
