Scala FAQ: How do I convert a String to Int in Scala?Solution: Use 'toInt'
If you need to convert a String to an Int in Scala, use the toInt method, which is available on String objects, like this:
scala>val i = "1".toInti: Int = 1
As you can see, I just cast the string "1" to an Int object using the toInt method, which is available to any String.
If you need to convert a String to an Int in Scala, use the toInt method, which is available on String objects, like this:
scala>val i = "1".toInti: Int = 1
As you can see, I just cast the string "1" to an Int object using the toInt method, which is available to any String.
[
add
]
[
|
|
...
]