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
image
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 :thinking:

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 :wink: ! Great then :smiley: :+1:

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.