I have a line in my Scala program that I would like to use as Int.
def foo(): Int = x.getTheNumericString().toInt
The problem is that x.getTheNumericString() comes from the Java library and returns java.lang.String , which does not have a toInt method.
I know that I can create a Scala string with val s: String = "123" , but I noticed that when I create a string like val t = "456" , I get java.lang.String . I heard that a Scala String is just a wrapper around java.lang.String , but I have not found clear documentation on how to drop to a Scala string.
Is there some kind of function that I can use, for example:
def foo(): Int = f(x.getTheNumericString()).toInt
As of now, my compiler complains about the original definition of value toInt is not a member of String
munk source share