# convert 4 to 04 in knime

hello I need to convert a number that is 4 to 04 however I already have numbers like 28 that need to remain the same and not 028 thanks

for example i need 9 convert 09 and 10 = 10

Hi @Jalvear
Step 1: ‘Math Formula’ node
\$number\$ + 100
Step 2: ‘Number to String’ node
Step 3: ‘String Manipulation’ node
substr(\$number\$, 1)

BR

2 Likes

Hi @Jalvear

Could you please precise whether your column is originally in string format or in numerical (integer, long, etc.) ?

@gonhaddock when looking at your solution (which btw is a nice trick ;-)) I wonder whether @Jalvear numbers go beyond 99 value

Best

Ael

2 Likes

wow amazing solution, thanks!

1 Like

they are date values ​​so this solution works wonders for me

Good to know it ! Great then

Good touch @aworker !
You can just add 1 000, 10 000 … depending on the length of your string.

BR
PS.- we can describe it as ‘adding zeros to the left’

1 Like

I love this trick lol !

@aworker
I had used this approach before. A practical example

1 Like

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