Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to parse numbers only from a string?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00728861
Message ID:
00729238
Views:
17
Yes, its elegant...
But not from me :-)

I dont remember who post this solution first, but I use it many times in my code...



>What an elegant solution. Kudos
>
>Glenn
>
>>This will remove any chars that was not in the inner chrtran:
>>
>>
>>cMixed="MESS:(999) 999-9999"
>>cNumOnly=chrtran(cMixed,chrtran(cMixed,"0123456789",""),"")
>>
>>
>>HTH
>>
>>>Hi all:
>>>
>>>I currently have an Excel spreadsheet with data from an MDB file, which I plan to insert into a new VFP free table.
>>>
>>>
USE Details
>>>ZAP
>>>APPEND FROM c:\Delta\Clients TYPE xls
>>>
>>>The above code works. I proceed to select information from Details.dbf into a cursor and then assign some variables their values from the fields in the cursor.
>>>
>>>Problem: There is one field which contains the phone numbers along with their area codes, formatting and sometimes it even contains text e.g.
>>>
>>>
MESS:(999) 999-9999
>>>
>>>How do I parse the numbers only i.e. only the 9999999999, so that I can assign this vlaue to a variable which will then be inserted into the main client table.
>>>
>>>Thank you for your guidance.
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform