Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove excessive spaces in string
Message
De
28/07/2009 17:53:21
 
 
À
28/07/2009 15:45:59
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
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 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01414370
Message ID:
01415194
Vues:
49
>>So, it's possible to reduce series of spaces (or any other characters) down to 1 with a fixed number of STRTRAN() calls:
>>
>>- up to and including 4,096 spaces with 7 STRTRAN() calls
>>- up to and including 1,048,576 spaces with 9 STRTRAN() calls
>
>I've always done this by
>
>do while "{2**n spaces}"$string
> string=strtran(...)
>enddo
>
>But now... if the limit to reduce() is 64K, I'd chop the string into pieces smaller than that, and reassemble the results. Should be faster than going it all in Fox.

I just ran some tests with 64K spaces:
Spaces: 2^16  Passes: 1000  Milliseconds: 4507  (REDUCE in FoxTools.FLL)   
Spaces: 2^16  Passes: 1000  Milliseconds: 1352  (Reduce_Successive)  
Spaces: 2^16  Passes: 1000  Milliseconds: 16634  (Reduce_Loop)
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
Répondre
Fil
Voir

Click here to load this message in the networking platform