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 11:37:39
 
 
À
19/07/2004 11:09:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00925773
Message ID:
00925783
Vues:
16
>Hi,
>
>What is the best/fastest way to remove trailing carriage returns/line feeds from a string?
>
>Example:
>
>cString = "This is what I want to keep!"                         + ;
>          Space (10) + Chr (13) + Chr (10) + Chr (13) + Chr (10) + ;
>          Space ( 1) + Chr (13) + Chr (10) + ;
>          Space ( 1)
>
>After execution of the routine, all trailing blanks/CR/LFs should be removed (last 18 characters removed, first 28 characters ketp).
>
>TIA
>
>Fernando

Fernando,

I think this is about as fast as you can get (no vfp9)

Second is the faster
*---------------------------------------------------------------------------
function StripTrailing(s)
	
	return left(m.s, len(rtrim(strtran(strtran(m.s, chr(10), ' '), chr(13), ' '))))
endfunc
*---------------------------------------------------------------------------
function StripTrailing2(s)
	
	return left(m.s, len(rtrim(chrtran(m.s, chr(10)+chr(13), '  '))))
endfunc
*---------------------------------------------------------------------------
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform