Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locating a number within a character string
Message
De
28/04/2000 22:48:00
 
 
À
28/04/2000 11:45:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00364345
Message ID:
00364743
Vues:
23
Thank you for responding. I am looking for a function to return the position of the first occurance
of any number in a character string. ie m.address = "El Paso, Tx. 79902 "
? at(m.address,FirstNumericalOccurance) would return 14

I have written several routines which return the value, but they are too process intense and slow for a large table:

m.address = "El Paso, Tx. 79902 "
m.position = 0
i=1
for i=1 to len(m.address)
StringValue = substr(m.address,i)
IF type(StringValue) = "N"
m.position = i
break
ENDIF
NEXT

If m.position = 0
? "No number"
ELSE
? "The first number is at "+val(m.position)
ENDIF

Thank you very much for any input.

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

Click here to load this message in the networking platform