Last active
August 29, 2015 14:15
-
-
Save krmgns/805865db372e497a3e07 to your computer and use it in GitHub Desktop.
Simple string formatter.
This file contains hidden or 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
function formatString() { | |
var args = arguments, s = args[0], ms = s.match(/(%s)/g) || [], i = 1, m; | |
while (m = ms.shift()) { | |
s = s.replace(/(%s)/, args[i++]); | |
} | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment