Add Character at the beginning of a String


I have a question. I have a column with 4 digit and 5 digit numbers. For each 4 digit number I want to add a 0 at the beginning. E.g. 1234 → 01234. Can someone help me how I can do this in KNIME?

Many Thanks

Hi @Manuel93, welcome to KNIME Forum

Go for the StringManipulation node;

padLeft(columnname, 5, “0” )

Where 5 = new length of the string

gr. Hans


Hi Manuel,

Number never start with “0”, integer, double and others types respect the information format. To change it, you need:

1- Split rows to separate under 1.000 for 4 digits. In this case, identify by numbers rules until 9999. This note have 2 paths, one for more than that and other for less which you can see the output to check the values and adjust as you need.

With less numbers, you have to manipulate the format to string with string manipulation node and just make a single expression:


and replace or create another column to store the value.

If you need to merge both again, you need to convert the other number to string too and then, just use the merge node to put all together again.

Flow example add:

number to string.knwf (34.2 KB)

I hope its solve your problem.

Best regards,


Hey HansS, thanks for the quick solution

Denisfi also thank you for the quick feedback

best regards

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.