Format number of Six characters since data set with differet format and add 0 before

Hello,
i would like to omogenize my table in this way, having a format number of six characters.
image

My starting table have a lot of record of 4/5 characters and i would like to add “0” in front of the different cases.
image

For example the code “1309” must become “001309” or the code “15011” in “015011”,

Which kind of node or expression in “String Manipulation” can i use?

Thank in advance for every suggestion.

Hello @albertoruggeri1,

You can use an expression like:

“padLeft($COL-1$, 6, “0”)”

output:

Screenshot 2024-01-18 154431

1 Like

Hi,

if you are already on 5.2, you can also use the new String Cleaner – KNIME Community Hub node. It can pad strings to a selected length by filling with a user-defined character, just like the pad functions in the String Manipulation node, but no coding required.

Have a nice day,
nan

2 Likes

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