Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert number to a char string
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01672170
Message ID:
01672231
Vues:
104
I think what you're trying to do is not possible with a native built-in function. But you can certainly write code to do this but it'll be relatively slow.

The point really is this though: Why would you ever not know the output format that you want the string to be? You should always know how many significant digits you are using and based on that you can use TRANSFORM() with the appropriate template. Otherwise something has to guess your intentions.

If you do this manually you can trim off trailing 0's which is likely to give you very unsatisfying results too (rarely do you want to see numbers iwth a single decimal value for example).

+++ Rick ---


>Hi,
>
>I am trying to create a generic way to convert any number to a string. Here are some examples, of the number and how they should be as a string:
>
>
>2.4       ->  "2.4"
>.00       -> ".00"
>500.32337   -> "500.32337"
>8.342    -> "8.342"
>
>
>I tried TRANSFORM() but the second parameter has to match the number of decimal digits.
>
>Any suggestions?
>
>TIA
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform