Given an input Map[String,String] such as
val in = Map("name1" -> "description1",
"name2.name22" -> "description 22",
"name3.name33.name333" -> "description 333")
what is a simple way to extract each name and each description and feed them into a method such as
def process(description: String, name: String*): Unit = name match {
case Seq(n) => // find(n).set(description)
case Seq(n,m) => // find(n).find(m).set(description)
case Seq(n,m,o) => // find(n).find(m).find(o).set(description)
case _ => // possible error reporting
}
Many Thanks
def process(tuple: (String, String)*)ordef process(description: String, name: String), as either you can to process each entry one by one, or process all entries at once (which mean more than one 1 description).