Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The simplest way to convert a number?
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00575272
Message ID:
00575280
Views:
19
I think it would with following adjustment
? Round(lnNum, -(Len(Strtran(Transform(lnNum),"-"))-1))
>I didn't know, that round function accepts negative second parameter. Would it work for negative numbers (not that I need it, but now just from curiosity) :)?
>
>>
lnNum = 4567
>>? Round(lnNum, -(Len(Transform(lnNum))-1))
>>
>>>Hi everyone,
>>>
>>>I'd like to convert numbers to the following:
>>
>>>5->5            ROUND(...,0)
>>>52->50          ROUND(...,-1)
>>>333->300        ROUND(...,-2)
>>>4567->5000      ROUND(...,-3)
>>>1234567->1000000, e.g. to the round number.
>>>
>>>What would be the simplest algorithm for this?
>>>
>>>Thanks in advance.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform