Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to strip out trailing blanks/CR/LFs from a stri
Message
De
19/07/2004 12:59:58
 
 
À
19/07/2004 12:43:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00925773
Message ID:
00925827
Vues:
20
* Alan Popow

t1= Seconds ()

For I = 1 To 100000
    Do While Right (cSourceString, 1) $ (" " + Chr (13) + Chr (10))
       cSourceString = Left (cSourceString, Len (cSourceString) -1)
    EndDo
EndFor

Elap4 = Seconds () - t1

* Mike Pratt 

t1= Seconds ()

For I = 1 To 100000
    Do While InList (Right (cSourceString, 1), Chr (32), Chr (10), Chr (13))
	   cSourceString = Left (cSourceString, Len (cSourceString) - 1)
    EndDo
EndFor

Elap5 = Seconds () - t1

Attention, with this code you do only one true computation.

Use a temporary var:
* Alan Popow

t1= Seconds ()

For I = 1 To 100000
    crem=cSourceString
    Do While Right (crem, 1) $ (" " + Chr (13) + Chr (10))
       crem = Left (crem, Len (crem) -1)
    EndDo
EndFor

Elap4 = Seconds () - t1

* Mike Pratt 

t1= Seconds ()

For I = 1 To 100000
    crem=cSourceString
    Do While InList (Right (crem, 1), Chr (32), Chr (10), Chr (13))
	   crem = Left (crem, Len (crem) - 1)
    EndDo
EndFor

Elap5 = Seconds () - t1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform