Skip to content
⌘ NSIS Forum Archive

Convert integer to string with leading zeros?

3 posts

nsnb#

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?