Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I script over my method code to work on it?
Message
 
À
19/11/2009 10:28:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01435595
Message ID:
01435646
Vues:
82
Hi Matt,

I think You can automate the whole thing, unfortunately I do not have much time to fully test the RE so take my script as a very early starting point, just an idea, but you could do something like this:
* instead of text...endtext use adir to get the prgs, a loop and filetostr() for PRGs, and adding a USE / REPLACE for hacking the SCX/VCX

CLEAR

TEXT TO lcFileContents FLAGS 1 PRETEXT 1 + 2 + 4 noshow
	m.job_num=alltrim(job_num)
	 lcJobNo=alltrim(job_num)
	 x=y+1*4/2
	 x=(x+y)/3
	 lcString='Please help+lcMe+'fix this.'
ENDTEXT




loRegEX			= Createobject('VBScript.RegExp')			&& Create a regular expression.

WITH loRegEX
	.Pattern		= '(.*?)(\s*?[=\+\*/]{1}?\s*?)+(.*?)'	&& Set pattern.
	.IgnoreCase		= .T.										&& Set case insensitivity.
	.Global			= .T.										&& Set global applicability.
	lcNewContents		= .Replace(lcFileContents, '$1 $2 $3')
ENDWITH

? lcNewContents && this should be a strtofile(), of course you should back up everything :)
Note that in the pattern I have [=\+\*/], that is for = + * / symbols (I even forgot about -), you can add the ones you want there
"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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform