Hi Guys,
I have a small function to achieve i.e, I want add leading Zero's to the input which have Long as Datatype:
Output:
0000007865
0002333342
0022373461
0000236327
Hi,
We can achieve the same thing in different ways. I thought this solution could be very precise and simple.
Use the fallowing expression:
("0000000000" +row1.Test).substring(row1.Test.length())
here row1.Test would be your input & based on the size u can increase/decrease the zeros.
-Bhanu
Thanks Kumar.talend & BhanuChandar For u r kind suggestions but, i have already performed using ternary expression based on length, can u suggest me using String format.
Earlier I tried this one:
StringHandling.LEN(Var.var1)==5?"00000"+Var.var1:
StringHandling.LEN(Var.var1)==6?"0000"+Var.var1:
StringHandling.LEN(Var.var1)==8?"00"+Var.var1:
Var.var1
Output: