? Transform(123, '@L 99999') && 00123
Thierry Nivelet
FoxInCloud
Give your VFP app a second life in the cloud
http://foxincloud.com/
Le 12/09/2016 à 21:39, Gene Wirchenko a écrit :
Hello:
On Foxite, Shaheryar Rashed started a thread "slow save at
network". While I had nothing to add in general, I did note some
awkward code:
mvoucher = Right('0000' +
Alltrim(Str(Thisform.voucherno1.Value)),5)
How do you do leading zeroes cleanly? This is a thing that has
bothered me. One would think it would make an excellent option for
transform(). There is @L but
transform(123,"@L")
generates "0000000123.00" which is not anything that anyone is likely
to want. Usually, I want leading zeroes on integers.
transform() is not the answer; padl() is. Suppose you have 123
and want "00123".
padl(123,5,"0")
does it. Since the VFP documentation does not specify how the first
expression is stringised, you might prefer
padl(transform(123),5,"0")
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.