Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert number to string and back
Message
De
31/03/2008 12:02:05
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01306961
Message ID:
01306977
Vues:
8
>>>I want to convert an arbitrary number with an arbitrary number of decimal places to a string and back, and get the exactly the same number, for example:
>>>
>>>1234.5678 to string "1234.5678" to number again 1234.5678
>>>456 to string "456" to number again 456 (not 456.00)
>>>987654325.123456 to string "987654325.123456" to number again 987654325.123456
>>>
>>>I don't know in advance the number of digits or number of decimal digits.
>>>
>>>I don´t mind if the string is in any other format, like binary bytes or anything like that, I just want to get exactly the same number back. This is for storing a numeric value in the registry as a binary string, and then get back the number stored.
>>>
>>>Any ideas?
>>
>>Carlos,
>>
>>This looks promising
>>
>>(1) store in reg:
>>transf(xxx)
>>
>
>No, this should be rtrim(padr(xxx,100))


Why, if I may ask ??

>
>>(2) get it back
>>yyy = eval(retrieved from reg)
>>
>
>Good idea.
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform