Created
September 12, 2011 20:09
-
-
Save ramn/1212247 to your computer and use it in GitHub Desktop.
Simple Template (Scala)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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