Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing multiple blanks
Message
De
11/06/2007 20:03:10
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
11/06/2007 19:50:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01232128
Message ID:
01232130
Vues:
17
>I know there has to be a better way of doing this than
>FUNCTION rem_mult_blanks(tcString)
>DO WHILE "  " $ tcString
>  tcString = STRTRAN(tcString,"  "," ")
>ENDDO
>
>RETURN tcString
>
>but I can't seem to remember what it is.

There's a Reduce() function in FoxTools.fll, or if you don't want to use that, you can just improve your algorithm:
FUNCTION rem_mult_blanks(tcString)
i=32
lcSpace=space(i)
do while i>1
  DO WHILE lcSpace $ tcString
    tcString = STRTRAN(tcString,lcSpace," ")
  ENDDO
  i=i/2
  lcSpace=space(i)
enddo
RETURN tcString

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