Page 1 of 1
Padding Zero's to the left of an integer
Posted: Sat Dec 01, 2007 12:31 am
by suchit1983
Hi,
How to pad zero's to the left of an integer?
I have 2 inputs Id1(Integer 21) and Id2(Integer 4)
I want the output as Id3(Integer 25)
Logic for Id3 : Concat Id1 and Id2
If Id2 = 24, my output should be Id1:0024
If Id2 = 235, my output should be Id1:0235
Please provide a approach for this.
Re: Padding Zero's to the left of an integer
Posted: Sat Dec 01, 2007 1:06 am
by pavankvk
suchit1983 wrote:Hi,
How to pad zero's to the left of an integer?
I have 2 inputs Id1(Integer 21) and Id2(Integer 4)
I want the output as Id3(Integer 25)
Logic for Id3 : Concat Id1 and Id2
If Id2 = 24, my output should be Id1:0024
If Id2 = 235, my output should be Id1:0235
Please provide a approach for this.
Try
Str function. follow the syntax.
Str('0',(4-Len(Id2)):Id2)
Re: Padding Zero's to the left of an integer
Posted: Sat Dec 01, 2007 1:07 am
by pavankvk
suchit1983 wrote:Hi,
How to pad zero's to the left of an integer?
I have 2 inputs Id1(Integer 21) and Id2(Integer 4)
I want the output as Id3(Integer 25)
Logic for Id3 : Concat Id1 and Id2
If Id2 = 24, my output should be Id1:0024
If Id2 = 235, my output should be Id1:0235
Please provide a approach for this.
Try
Str function. follow the syntax.
Str('0',(4-Len(Id2)):Id2)
Posted: Sat Dec 01, 2007 1:44 am
by suchit1983
Thanks a lot Pavan...