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!
Discussion (4)1
Comments
$tr($justify(12345,10,0),” “, 0)
Use Pad function in DTL
.png)
Hi Ingo,
You could look into Ens.Util.FunctionSet, there is a Pad() method. Those utility functions can be used in DTLs.
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…
Good luck!
Marcel
If your number is an integer
write $extract(1E10 + 12345, 2, 11) // if N is a fixed value, here N = 10or
write $extract("1E"_N + 12345, 2, N+1) // if N is variableThe game ends if your number has more than 18 (decimal) digits!