Skip to main content
Liphou
Inspiring
May 30, 2011
Answered

[JS] Perl's equivalent JavaScript "commende Perl équivalent Javascript"

  • May 30, 2011
  • 1 reply
  • 901 views

hello,

Is it possible to have an equivalent to the command "sprintf" in to enable javascript?

Example : 1 -> 01

Order perle : sprintf ("% 02s", $ number)

Thank you

Translation

bonjour,

Est-il possible d'avoir un équivalent à la commande "sprintf" en per vers javascript?

exemple : 1 -> 01

la commande perlesprintf("%02s",$nombre)

Merci

This topic has been closed for replies.
Correct answer John Hawkinson

No.

There is no such equivalent. You have to roll your own.

Try googling, or look at http://stackoverflow.com/questions/2998784/how-to-output-integers-with-leading-zeros-in-javascript for some examples.

(p.s. very misleading Subject line!)

1 reply

John Hawkinson
John HawkinsonCorrect answer
Inspiring
May 31, 2011

No.

There is no such equivalent. You have to roll your own.

Try googling, or look at http://stackoverflow.com/questions/2998784/how-to-output-integers-with-leading-zeros-in-javascript for some examples.

(p.s. very misleading Subject line!)

Liphou
LiphouAuthor
Inspiring
June 1, 2011

Thank you