matchのcase内で"@"を使うことで変数を束縛できる。
変数名 @ パターン のような感じ
以下のような感じ
def service(request: String) = {
val splitRequest:Array[String] = request.split(" ");
splitRequest match {
case Array(cmdString, other @ _*) =>
println(other)
case _ =>
}
}
sevice("hoge fuga piyo")とか呼び出すと'Vector(fuga,piyo)'という出力になる
fuga以降のArrayデータを束縛できた