cs_Moria
Messages postés31Date d'inscriptionlundi 29 juillet 2002StatutMembreDernière intervention12 septembre 2002
-
29 juil. 2002 à 18:21
DeAtHCrAsH
Messages postés2670Date d'inscriptionvendredi 25 janvier 2002StatutMembreDernière intervention 6 février 2013
-
2 août 2002 à 16:12
Slt,
Ma chaine se presente comme ceux-ci :
mot1|mot2|mot3|
Comment mettre dans differentes variables :
mot1
mot2
mot3
Pour les exploités independaments...
Seb_d_angers
Messages postés155Date d'inscriptionvendredi 2 novembre 2001StatutMembreDernière intervention19 mai 2011 29 juil. 2002 à 21:08
Dim mot(10) As String
cpt_mot = 0
chaine = "mot1|mot2|mot3|"
i = 1
While i <= Len(chaine) And Len(chaine) > 0
letttre = Mid(chaine, i, 1)
If Mid(chaine, i, 1) = "|" Then
mot(cpt_mot) = Left(chaine, i - 1)
Debug.Print mot(cpt_mot)
chaine = Replace(chaine, Left(chaine, i), "")
i = 0
cpt_mot = cpt_mot + 1
End If
i = i + 1
Wend
For i = 0 To cpt_mot - 1
MsgBox mot(i)
Next
Si tu sais pas comment marche le tant que va sur mon site
*********************************
J'espère t'avoir aider
A+
Seb
http://www.programmez.org
shyangel
Messages postés17Date d'inscriptionmardi 14 mai 2002StatutMembreDernière intervention16 janvier 2003 30 juil. 2002 à 10:02
Il y a un peu plus simple grâce à une fonction VB : split(chaîne, séparateur)
dim intI as integer
dim strTab() as string
strTab = split("mot1|mot2|mot3", "|")
for intI = lbound(strTab) to ubound(strTab)
msgbox strTab(intI)
next intI
Chaque élément du tableau strTab contient un mot : strTab(0) mot1, strTab(1) mot2, strTab(2) = mot3
Voilà ;-)
----------------------------------------------
un ange passe ...
DeAtHCrAsH
Messages postés2670Date d'inscriptionvendredi 25 janvier 2002StatutMembreDernière intervention 6 février 2013 2 août 2002 à 16:12
Split ne marche que sur VB6...
Pour les versions anterieur vous pouvez aussi le faire d'une maniere un peu differente avec la fonction Instr...
SI ca vous interresse, je pourrez laisser un ptit exemple ...
A++ et bonne prog...
DeAtH_-_CrAsH
P.S : Sinon pour ce qui prefere Split mais qui n'ont pas VB6, j'ai laissé sur ce site, une source avec une reconstitution de la fonction Split, et celle ci marche sous toute les versions de VB..
Voili voilou