Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
標準入力からのデータ読み込みのテスト用のScalaのプログラム。
package info.pandanote.utf8stdintest
// See https://pandanote.info/?p=5265 for details.
import java.io.BufferedInputStream
import scala.io.Source
import scala.io.Codec
import scala.util.matching.Regex
import java.nio.charset.{Charset,CodingErrorAction}
import java.io.BufferedReader
import java.io.InputStreamReader
object UTF8StdinTest {
val mm = """(\S+) (\S+) (\S+)""".r
def main(args: Array[String]) = {
Source.fromInputStream(System.in)("UTF-8").getLines.foreach(l => l match {
case mm(date,section,fare) => println(date+":"+section+":"+fare)
case x => println("その他")
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.