Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Let's see
Message
De
30/03/2021 07:45:38
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
30/03/2021 07:21:44
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01679334
Message ID:
01679343
Vues:
88
>>>
lcString="ABC,DEF,GHI,JKL"
>>>lcString2=""
>>>x=0
>>>do while x<len(m.lcString)
>>>  x=m.x+1
>>>  IF SUBSTR(m.lcString,m.x,1)<>","
>>>    lcString2=m.lcString2+substr(m.lcString,m.x,1)
>>>  ENDIF
>>>enddo X
>>>?m.lcString2
>>
>>Why not just:
>>
>>
>>lcString="ABC,DEF,GHI,JKL"
>>lcString2 = STRTRAN(m.lcString, ',', '')
>>?lcString2
>>
>
>Why use STRTRAN to do the job of CHRTRAN?

There is more then one way to skin the fox.
lcString="ABC,DEF,GHI,JKL"
lcString2 = lcString
Do While Occurs(',',lcString2)>0
	lcString2 = Substr(lcString2,1,At(',',lcString2)-1)+Substr(lcString2,At(',',lcString2)+1)
Enddo &&OCCURS(',',lcString2)>0
?lcString2
or
lcString="ABC,DEF,GHI,JKL"
lcString2 = lcString
Do While Occurs(',',lcString2)>0
	lcString2 = STUFF(lcString2,At(',',lcString2),1,'')
Enddo &&OCCURS(',',lcString2)>0
?lcString2
edit:
or
lcString="ABC,DEF,GHI,JKL"
lcString2 = lcString
FOR i = Occurs(',',lcString2) TO 1 STEP -1
	lcString2 = STUFF(lcString2,At(',',lcString2,i),1,'')
endfor
?lcString2
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform