Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
183
rated 0 times [  184] [ 1]  / answers: 1 / hits: 24851  / 13 Years ago, fri, april 15, 2011, 12:00:00

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.


More From » jquery

 Answers
27

A previous question Javascript printf/string.format has some good information.



Also, dive.into.javascript() has a page about sprintf().


[#92711] Thursday, April 14, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
viridianaw

Total Points: 154
Total Questions: 94
Total Answers: 89

Location: South Georgia
Member since Sun, Aug 8, 2021
3 Years ago
;