Skip to content

Instantly share code, notes, and snippets.

@ramn
Created September 12, 2011 20:09
Show Gist options
  • Save ramn/1212247 to your computer and use it in GitHub Desktop.
Save ramn/1212247 to your computer and use it in GitHub Desktop.
Simple Template (Scala)
val varPattern = """\$\{([^}]*)}""".r
def template(text: String, vars: Map[String, String]) =
varPattern replaceSomeIn (text, m => vars get (m group 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment