Cancoon2000
18th February 2004, 19:08
Hello,

I tried to search for a function to add leading ZEROs or any other string character to a Fixed length string, but did not find an answer.

string xxx(4) fixed
string yyy

yyy = "9"
I am looking for a function to give me the xxx as "0009"

Any guide line will be very helpful

Thanks

gfasbender
18th February 2004, 20:15
xxx = sprintf("%04d", lval(yyy))

NPRao
18th February 2004, 20:32
Alternatively-

string scomp(3)
scomp = edit$(ttaad100.comp,"999")

Cancoon2000
18th February 2004, 21:38
Thank you so much, that worked for me.