Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing a string
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01158677
Message ID:
01158756
Vues:
27
Took about 2 minutes to do, but here's what I came up with...
lnRepeat	= 6
lcX = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,10"
? lcX
FOR lnI = 0 TO OCCURS(",", lcX ) / lnRepeat
	lcX = STRTRAN( lcX, ",", "," + CHR(13)+CHR(10), ( (lnI+1) * lnRepeat), 1 )
ENDFOR 
?
? lcX
>If I have a very long string containing data separated by commas, and I wanted to replace every 6th occurance of a comma with a comma plus carriage return, is there a single command that would do this? I could do it with a loop but it seems like there is a simpler way to accomplish it with STRTRAN or something similar.
>
>Thanks for your suggestions.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform