Hi there!
To convert a string to an integer you can use String.to_integer/1 e.g.
int = String.to_integer("1")
When it comes to user input you might also want to remove whitespace first which you can do with String.trim/1.
Hope that helps!
Hi there!
To convert a string to an integer you can use String.to_integer/1 e.g.
int = String.to_integer("1")
When it comes to user input you might also want to remove whitespace first which you can do with String.trim/1.
Hope that helps!