Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
string-char-to-int-pitfall

In Kotlin String.toInt() and Char.toInt() do very different things.

>>> "9".toInt()
9
>>> '9'.toInt()
57
>>> 

The former parses the String to an Int. The latter returns the Unicode codepoint value of the character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment