Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why one code works, while other doesn't?
Message
De
22/01/2001 17:13:54
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00466654
Message ID:
00467014
Vues:
33
>I found a problem. Somehow the lcPattern variable definition was changed. Instead of
>
lcPattern=left(tcDBFName,lnPos+1)+'???'+substr(tcDBFName,lnPos+4)
>it was something different. Therefore the program just didn't do anything...
>
>I'm testing the speed difference right now.
>
>>>Should I revert the code back to the original cursor idea?
>>
>>As far as effeicent goes, I'd bet that the cursor idea is faster anyways, so yes. You could easily test it out.

If speed is the issue, and you're replacing a character by character (not string by string), you may check using ChrTran() instead of StrTran() - it should be faster.

Another handy trick, assuming you're replacing two characters with three question marks, instead of
lcPattern=left(tcDBFName,lnPos+1)+'???'+substr(tcDBFName,lnPos+4)
you could use
lcPattern=Stuff(tcDBFName,lnPos+2, 2, '???')
A single function should be faster than two functions plus two string concatenateions. Besides, I always thought that all the string chopping functions (left, right, substr()) are internally done as Stuff() with special parameters.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform