Archive: Convert integer to string with leading zeros?


Convert integer to string with leading zeros?
What is the proper way to pad a given integer (stored in a variable, e.g. $0) with zeros, so that it always have the same string length?

In C, it's as easy as:

 printf ("Preceding with zeros: %010d \n", 1977);

With output:
Preceding with zeros: 0000001977
But in NSIS, there is no printf (and no 'int' type).

What's the trick?

IntFmt.

Stu


Originally posted by Afrow UK
IntFmt.
Thanks Stu. You are always so helpful.