Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strip Character from String
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01440372
Message ID:
01440384
Vues:
55
Just to give a different option, you could use regular expressions like this:
lcString			= [I have some character fields that represent time, for example: 07:00, 08:45, etc]
loRegExp			= Createobject('VBScript.RegExp')

with loRegexp as VBScript.RegExp
	.IgnoreCase			= .T.
	.Global				= .T.
	.Multiline			= .T.
	
	.Pattern			= '(\d\d):(\d\d)'
	lcNewText			= .Replace(lcString, '$1$2')
endwith

? lcNewText
Notice that I edited a little bit your message so it has a colon that is not part of the time, that would be changed by strtran but it is not changed by the regular expression, that is why I showed this alternative, which might be irrelevant in your case.

PS

An even better solution would be to set the pattern to valid hours.
"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