Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locating a number within a character string
Message
From
28/04/2000 22:48:00
 
 
To
28/04/2000 11:45:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00364345
Message ID:
00364743
Views:
24
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform