I\'m trying to parse 100 50-digit numbers from string with below piece of code:
val input = \"\"\"37107287533902102798797998220837590246510135740250
Probably you're on Windows, where the EOL is \r\n.
You've got to strip that, too.
Here, I rebooted into Windows to demo...
apm@halyard ~/tmp
$ vi bigbomb.scala
apm@halyard ~/tmp
$ skalac bigbomb.scala ; skala bigbomb.Test
"ava.lang.NumberFormatException: For input string: "35740250
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
Note that in cygwin, I have to :se fileformat=dos
in vi to use the \r\n line endings.
Here is an example where the unacknowledged impedance mismatch between the source EOL and the runtime EOL bugged me:
some dumb code
You want to use s.lines.mkString
to strip it out.