Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find a phone number inside a string
Message
De
05/06/2008 15:37:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01321918
Message ID:
01321960
Vues:
22
FANtastic Naomi, thanks!

>>I need to determine if any combination of numbers formatted like this: 999-9999 is within a string. The string may have (999)999-9999 or 999-999-9999 or anything else, but it will always have 999-9999 (123-1234, 987-321-9382, etc). Any way to do that? Perhaps the string is:
>>
>>Examples:
>>
>>Suite 100 123-1234  && .t. because it contains 123-1234
>>Bldg J (910)222-2222  && .t. because it contains 222-2222
>>
>
>Convert all numbers to digits 9 and then check.
>
>With simple chrtran()
>
>lcNumbers = '0123456789'
>
>lcNewString = chrtran(m.lcString,m.lcNumbers, replicate('9',10))
>
>? "999-9999" $ lcNewString
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform