Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strip leading zeros
Message
 
À
20/10/2009 18:17:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01430254
Message ID:
01430280
Vues:
55
You can try a regular expression then:
clear
LOCAL laTest(4), i

laTest[1]	= "0002567890"
laTest[2]	= "0000027890"
laTest[3]	= "00002678-1"
laTest[4]	= "0000000002"

loRegEx			= Createobject('VBScript.RegExp')

with loRegEx as VBScript.RegExp
	.Pattern		= '^0+(.*)'
	.IgnoreCase		= .T.
	.Global			= .T.
	
	FOR i = 1 TO ALEN(laTest, 1)
		? .Replace(laTest[i], '$1')
	NEXT i
ENDWITH
"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