Implements both a somewhat stripped down “classic” version of the C sprintf (no support for width, sign, padding and flags), and a python-like one employing named parameters.
Why another implementation, when we already have one? well:
`//sprintf //positional arguments var classic = $.sprintf(‘%s %d%% %.3f’, ‘string’, 40, 3.141593); // classic = ‘string 40% 3.142’
//named arguments var named = $.sprintf(‘%(name)s: %(value)d’, {name: ‘age’, value: 40}); // named = ‘age: 40’
//vsprintf var classic = $.vsprintf(‘%s %d%% %.3f’, [‘string’, 40, 3.141593]); // classic = ‘string 40% 3.142’
//named arguments var named = $.vsprintf(‘%(name)s: %(value)d’, [{name: ‘age’, value: 40}]); // named = ‘age: 40’`