Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert number to string and back
Message
De
31/03/2008 12:53:58
 
 
À
31/03/2008 12:51:10
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:
01307033
Vues:
9
>>>>
>>>>
>>>>xxx = transform(1234.56789)
>>>>yyy = eval(m.xxx) && no QUOTES
>>>>
>>>
>>>Gregory:
>>>
>>>This is getting interesting, I was getting a syntax error if I did not use the quotes, so I guessed you forgot them.
>>>
>>>Now, I tried again, still syntax error, then I realize that I have SET SYSFORMATS ON so the decimal separator is a ","
>>>
>>>Transform is converting the number to a string with a "," so EVAL gave me a syntax error, I should do s SET POINT TO "." before doing the transform:
>>>
>>>
>>>m.lcPoint = Set("Point")
>>>Set Point to "."
>>>xxx = transform(1234.56789)
>>>Set Point to m.lcPoint
>>>yyy = eval(m.xxx) && no QUOTES
>>>?xxx
>>>?yyy
>>>
>>>
>>>Thank you very much, this seems to work.
>>>
>>>Carlos
>>
>>Ok, in that case
>>
>>
>>xxx = strtran(transform(1234.56789), set('point'), '.')
>>yyy = eval(m.xxx)
>>
>
>Thank you, that works, it's simple and elegant.
>
>Carlos

I had assumed the decimal point was the dot in Argentina. I had that wrong

Eval() always uses the dot, regardless of the set('point')
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform