Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to strip / delete leading zeros ...
Message
 
 
To
15/10/2009 15:08:40
Harold Leggett
Information Services Group
Louisville, Kentucky, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01429527
Message ID:
01429531
Views:
71
The VAL() function doesn't care about leading zeros. What you see is display problem not result of conversion. You may want to wrap it into INT() if decimal part is not desired.
? VAL('00203')      && 203.00
? INT(VAL('00203'))     && 203
>Am doing data conversions with VFP 9.
>
>Need to strip leading zero (or zeros) from a character field (and ONLY leading zeros), then convert to a numeric.
>
>VAL('00203') returns 23 instead of the desired 203
>VAL('2098') returns 298 instead of the desired 2098
>VAL('0298') returns the desired 298 ...
>
>Can't help thinking that I am missing something, somewhere.
>
>Thoughts much appreciated.
>
>Best,
>
>Harold ...
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform