This is just a small function, that provides almost the same as php's sprintf.
Take a look at the docu of php's sprintf to get more informationen about the possibilities.
"Hi %s, you have %d new messages!".sprintf('Peter', 3); //Hi Peter, you have 3 new messages!
var text = "My name is %s and I'm %s, because I'm %1$s".; console.log(text.sprintf('Peter', 'holy')); //My name is Peter and I'm holy, because I'm Peter
Text Copyright by http://www.php.net/manual/en/function.sprintf.php
This function supports argument swapping, which means, you can use a argument as many as you want in the text. Just use for example following to output the first argument as string again.
"Si, glamour is %s, or is it not %1$s?".sprintf('useless');
Please take a look at this page: http://www.php.net/manual/en/function.sprintf.php to get more information about the possibilities.
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.blog comments powered by Disqus