Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting Numeric Data From Text String
Message
 
À
20/03/2013 15:50:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01568867
Message ID:
01568876
Vues:
32
>Sorry, I am Bit confused, can you please give me the complete code again, assuming that the File name is 123.txt
local loReg, lcString, loMatches, loMatch, loSubmatch, lcFile

clear

lcFile			= '123.txt'
lcString		= FileToStr(lcFile)
loReg			= CreateObject('VBScript.RegExp')
loReg.Pattern		= '.*(\(Total cha?r?g?e?s?\)\s?(\d+)\s)(\d+)\s?w'
loReg.Global		= .t.
loReg.IgnoreCase	= .t.
loMatches		= loReg.Execute(lcString)
if loMatches.Count > 0
	for each loMatch in loMatches
		loSubmatch	= loMatch.SubMatches.Item(2)
		? 'Those three unknown digits where:', loMatch.SubMatches.Item(1), 'Total charges:', loSubmatch
	endfor
else
	? 'No matches found'
endif
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform