Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function that counts how many numbers are in numeric fie
Message
De
03/01/2002 09:37:18
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
03/01/2002 08:53:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00600219
Message ID:
00600247
Vues:
17
>I was wondering if there is a function that will count the legth in a numeric field.
>
>My initial approach was to convert the numeric field to a character field, trim the field, and then use LEN().
>
>I am looking for the shortest route.
>
>Thanks..
>
>>> Wes

For the case of positive integers, you can use a combination of log10() and ceiling():

? ceiling(log10(12345))

You can also convert negative integers to positive with abs().

And, log10(0) would give you an error message.

Come to think of it, len(trans(MyNumber)) seems much simpler, after all.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform