Last active
November 7, 2016 10:33
-
-
Save faisal00813/260d2f2ee5826f151153e0ccc4cbc46b to your computer and use it in GitHub Desktop.
Substitues the variable with the value provided
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
/**code taken from http://stackoverflow.com/a/4051500/845019 | |
* substitutes the string with #{variableName} format | |
*/ | |
implicit def RichFormatter(string: String) = new { | |
def richFormat(replacement: Map[String, Any]) = | |
(string /: replacement) { (res, entry) => res.replaceAll("#\\{%s\\}".format(entry._1), entry._2.toString) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment