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
De
21/11/2009 16:37:50
 
 
À
19/11/2009 10:37:22
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:
01435980
Vues:
78
>>>Notice the spaces before and after the '+' and '=' signs? I just like the way it spreads out the code an makes it easier to read. Problem is, I've gots lots of old code that is written without the spaces. How could I fix this? When I open a method in the code editor, is there some script I can run? I tried to use Beautify, but no luck.
>>>Even worse, some methods have a mixture of the old way and the new way, so parsing though it all will require paying attention to that detail.
>>You may replace '=' with ' = ' ,but it may not work exactly if your = is already with spaces. I guess it's time for regular expressions...
>How can you implement regular expressions in the Find/Replace dialog box?

If you decide against messing with regular expressions, you could do the following (either with find-and-replace or programmatically with very little effort (APPEND prgfile SDF into a table with one field, LINE (C, 254), do the processing below, and dump it back out):

(1) Pick a special character that you never use within your code -- e.g., the pipe symbol: |

(2) Replace all "=" with "|=|" and replace all "+" with "|+|"

(3) Replace all CHR(32)+| with | and replace all |+CHR(32) with | (keep looping until no replacements)

(4) Replace all | with blank

-m.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform