I need a JavaScript function (or jQuery plugin) for printf
/sprintf
. It needs to support named arguments ("%(foo)s"
) and padding ("%02d"
), i.e. the following format string should work:
"%(amount)s.%(subunits)02d"
It only needs to support s
and d
, I don't care about all the other format strings (e.g. f
, x
, etc.). I don't need padding for strings/s
, just d
, I only need simple padding for d
, e.g. %2d
, %3d
, %04d
, etc.