Scala: How to convert a String to an Int (Integer)
Briefly

Use 'toInt' to convert a String to an Int in Scala. Beware of NumberFormatException s like in Java. Implement try/catch blocks to handle exceptions.
In Scala, consider a function returning 'Option[Int]' for safer string to int conversion. Returns 'Some(Int)' for successful conversion, 'None' if conversion fails.
Read at Alvinalexander
[
]
[
|
]