Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Character to numeric conversion
Message
De
29/12/2007 08:36:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01278292
Message ID:
01278311
Vues:
24
>I runned some more test an notice that
>
>It can import direct from a charcter field if
>there is not anything between numbers
>
>I must run before appending:
>
>if c_field type = "C"
>replace all c_field with onlynumbers
>
>is there a function for this ?

The function I gave you before. If you want to get rid of any character that is not a digit, you have to eliminate digits first, and use the remainder as a "mask" for chrtran(), i.e., to indicate what characters to eliminate. In the following example, variable x contains non-digit characters:
x = "123/456-789"
? chrtran(x, chrtran(x, "0123456789", ""), "")
* or, in a table:
replace all MyField with chrtran(MyField, chrtran(MyField, "0123456789", ""), "")
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