Question
Ingo Steiger · Nov 11, 2020

leading zeros

Hallo, I need a Ensemble transformation to fill up a 6 or 7 digit Number to a 10 digit string with leading zeros.

123456 --> 0000123456

1234567 --> 0001234567

Thank you!

00
0 4 115 2

Replies

If your number is an integer

write $extract(1E10 + 12345, 2, 11)   // if N is a fixed value, here N = 10

or

write $extract("1E"_N + 12345, 2, N+1)  // if N is variable

The game ends if your number has more than 18 (decimal) digits!