I have a set of strings that look like:
"user-123"
"user-498"
"user-9891"
I want to return a set of integers like this:
123
498
9891
I can do this:
val mySet = // ....
mySet.map(x => x.replace("user-").toInt)
But if the toInt parsing fails it will crash, what would be a safer way to do this?