Created
March 12, 2015 11:38
-
-
Save coreequip/2ee425459c1381778f0d to your computer and use it in GitHub Desktop.
A String.replacePlaceholder- function - Call: 'Text {place} and {holder}'.replacePlaceholder({ 'place': 'foo', 'holder': 'bar' })
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
String.prototype.replacePlaceholder=function(A){return this.replace(/\{(\w+)}/g,function(B,C){return A[C]})}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment