Arthur Marino wrote:

Now that it's been pointed out to me that the entire FOR expression is
evaluated at the 'endfor' (I thought it was evaluated once and just
tested at 'endfor'), I see why it didn't work at first. I still like
Terry's solution 'cause it's fewer instructions than mine and 123
correctly becomes 00123.

coldta = %subst( '000000000000000' // "lots" of zeros
: 1
: cwdth( #col ) - %len( coldta )
) + coldta;

Arthur:

But don't forget the [if %len( coldta ) < cwdth( #col );/endif;] that Terry originally supplied. If the value in coldta is already '00123' and [cwdth( #col )=5], the "IF" will save you. Also, if coldta='12345', then you can't add leading zeroes. Further, be sure that the length of coldta matches the number of characters in its value.

It seems as if you're receiving external data and massaging it. Be sure that it's properly clean for your technique.

Tom Liotta


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.