Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The simplest way to convert a number?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00575272
Message ID:
00575279
Vues:
23
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.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform