'Read a list input from using the StdIn.readf function
What is the propper way of read a list input using the readf function? The Scala Standard Library shows that the sintax is:
def readf(format: String): List[Any]
but I'm not finding to introduce on the Format field and always get the error:
Solution.scala:11: error: not found: value format val arr = scala.io.StdIn.readf(format:String) when try to store in arr list of Int.
Solution 1:[1]
the scaladoc said :
def readf(format: String): List[Any]
Reads in some structured input (from the default input), specified by a format specifier. See class java.text.MessageFormat for details of the format specification.format the format of the input.
returns a list of all extracted values.
Definition Classes StdIn Exceptions thrown java.io.EOFException if the end of the input stream has been reached.
So, go to your browser, search "java.text.MessageFormat", and find it : https://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |