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:33:09
 
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:
01321957
Vues:
27
Thank you so much for your time but I cannot use any scripting.

>Tracy,
>
>Hopefully I got it better this time (I know is not perfect (First result is wrong), but it can get you started)
>
>
>? HasAPhone([Suite 100 123-1234])
>? HasAPhone([Bldg J (910)222-2222])
>
>or
>
>? GetThePhone([Suite 100 123-1234])
>? GetThePhone([Bldg J (910)222-2222])
>
>function HasAPhone(tcString as String) as Boolean
>	loRegEx					= Createobject('VBScript.RegExp')
>	with loRegEx
>		.Pattern		= "((\(\d{3}\) ?)|(\d{3}[- \.]))?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$"
>		.IgnoreCase		= .T.
>		loResultSet		= .Execute(tcString)
>	endwith
>	return loResultSet.Count = 1
>endfunc
>
>
>function GetThePhone(tcString as String) as Boolean
>	loRegEx					= Createobject('VBScript.RegExp')
>	with loRegEx
>		.Pattern		= "((\(\d{3}\) ?)|(\d{3}[- \.]))?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$"
>		.IgnoreCase		= .T.
>		loResultSet		= .Execute(tcString)
>	endwith
>	return Iif(loResultSet.Count = 0, 'No Phone', loResultSet.Item(0).Value)
>endfunc
>
.·*´¨)
.·`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