X=98.20
? transform(X, "@RL 99999.99")

Dave

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Gene Wirchenko
Sent: 12 September 2016 20:40
To: ProFox Email List <[email protected]>
Subject: Leading Zeroes

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.

Reply via email to