Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace character expression
Message
De
08/07/2010 01:40:01
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01471799
Message ID:
01471803
Vues:
53
>is there a quick way to inspect a text document and change all [1] to [01] and all [2] to [02] etc something along the lines of what i have set up below (which doesn't work) - or should i be looking at another approach altogether?
>
>cFile = Filetostr("C:\mytext.txt") 
>
>cFile = Strtran(cFile,Chr(202),"E") && using this code i can change only one character at a time
>
>cFile = strtran(cFile,"[5]","[05]")  && can i use the same approach for character string - perhaps using chrtran??
>
If:

- you don't use the "[" character anywhere else
- you always want to put a "0" after it, no matter the length of the number between "[" and "]"

then you could just use STRTRAN() to replace each "[" with "[0".
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform