Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shvahabi/43f374eca011aeff04d35ecf3507dfcc to your computer and use it in GitHub Desktop.

Select an option

Save shvahabi/43f374eca011aeff04d35ecf3507dfcc to your computer and use it in GitHub Desktop.
string interpolation reverse matching
case class Person(name: String, age: Int)
val shahed = """{"name": "Shahed", "age": 42}""" match { case s"""{"name": $name, "age": $age}""" => Person(name, age.toInt) }
// val shahed: Person = Person("Shahed",42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment