Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting Numerics in Right-Aligned strings
Message
De
09/07/1997 08:10:59
 
 
À
09/07/1997 02:00:01
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00038937
Message ID:
00039064
Vues:
41
>>>>if you are talking about string in hebrew or arabic
>>>>the best way would be to use a localized version of windows and a localized
>>>>version of VFP (there is one for hebrew most probably an arabic version is
>>>>alos available - it shouldn't be too differnet)
>>>>
>>>>Arnon
>>>>
>>>>>
>>>>> What is the quickest way of converting numerics in right-aligned strings
>>>>> ??
>>>>>
>>>>> Is a handy method available with anyone or I have to write the whole
>>>>> routine myself...
>>>>>
>>>>> Thanks in advance...
>>>>>
>>>
>>>Sorry, I should have been more clear, see
>>>
>>>mynum=23.49 && actual length suppose 6,2
>>>mychar=allt(str(mynum)) && will return "23.49"
>>>
>>>&& I want " 23.49" & a space in front of 23.49
>>>
>>>this will give me a left aligned character, I want it right aligned(spaces padded in front of it)
>>
>>Maybe I'm missing something, but it seems obvious to me that the easiest solution is:
>>
>>str(mynum, 6, 2)
>>
>>Vlad
>
>Yes, this will work and this is the simplest...Thanks
>
>But speaking honestly, I'll still use Mr Dave's Method, as there I just have to specify total length, here I have to give 2 values, total length and decimal places, Actually Mr Dave's method is fitting perfectly in my code without much changes.
>
>Thanks again for your reply.

Don't you lose the decimals? The whole idea is that what STR function right aligns and it can get 1, 2 or 3 params. Ie: right(space(9)+alltrim(str(mynum)),9) is equivalent with str(mynum,9). In the 1st formula you just drop and add spaces at left, which is useless.

Vlad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform