This EKL snippet allows you to convert an Integer to a string and add a pre-set number of zeros to ensure that the total character count is set to a specified length.
First I added three parameters in the tree two Integers and a String.
Then I created a rule to drive the String’s value.
The Rule uses the Repeat function to repeat a string character a specific number of times. Within this method, I repeat a ‘0’ the number of required characters minus the current number of characters that the integer has, then I concatenate the integer at the end.
Finally I return this value back to the String parameter in the tree.
Let ioOutputString (String ) ioOutputString = Repeat("0", Number_of_Characters - (ToString(InputNumber)->Length())) + InputNumber Output_String = ioOutputString