Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing leading zeros
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00252593
Message ID:
00252776
Views:
12
>>>Hello everyone,
>>>
>>>Does anybody knows a simple way of removing 0's from a character field. Ex:
>>>
>>>'004'
>>>
>>>I want the content of the field to have '4'.
>>>
>>>Thanks,
>>>Sergio O.
>>
>>Hi Sergio,
>>
>>Just to demonstrate that there's more than one way. If you're using VFP 6.0:
lcresult = TRANSFORM(VAL('004'))
>>Only two function calls< g >.
>
>Hi George,
>
>I wasn't aware that the 2nd parameter was now optional. It's also different then what you get with an empty 2nd parameter. TRANSFORM(VAL('004'),'') returns ' 4.00' or however many 0's that SET DECIMAL is set to. Thanks for pointing that out.

Hi Fred,

Yep, in 6.0, the second parameter is optional. I don't recall if I noticed that from the docs or from one of the posts here. I do recall, however, that it (the ability to return a string without having to go through the TRIM()) busines was an item on the Wish List here at the UT.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform