Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Created September 4, 2019 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandanote-info/fc3da4553f3d94b51a5bdce40c875e79 to your computer and use it in GitHub Desktop.
Save pandanote-info/fc3da4553f3d94b51a5bdce40c875e79 to your computer and use it in GitHub Desktop.
標準入力からのデータ読み込みのテスト用の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