Fonction split - vbs

Résolu/Fermé
analog101 Messages postés 173 Date d'inscription mardi 1 avril 2008 Statut Membre Dernière intervention 25 février 2020 - 7 déc. 2009 à 09:46
 fethione - 25 oct. 2016 à 21:43
Bonjour,

Je n'arrive pas à découper ma chaine> toto, tata

titi.value=split(toto, tata)

j'aimerais récupérer que tata ( ce qu'il y a après la virgule+espace )


Qq un peut m'aider ?

merci.
A voir également:

4 réponses

Polux31 Messages postés 6917 Date d'inscription mardi 25 septembre 2007 Statut Membre Dernière intervention 1 novembre 2016 1 204
7 déc. 2009 à 10:26
Bonjour,

Voilà un exemple d'utilisation de la fonction Split()

Dim chaine As String
Dim mTab

    chaine = "toto, tata"
    
    mTab = Split(chaine, ",")
    
    MsgBox mTab(1)


Bonne continuation.

;o)
20
merci bcp!!!!!!!!
0
michel_m Messages postés 16603 Date d'inscription lundi 12 septembre 2005 Statut Contributeur Dernière intervention 16 décembre 2023 3 303
7 déc. 2009 à 10:31
bonjour

tachaine = "toto,tata,tutu"
tablo = Split(tachaine, ",")
petittiti = tablo(0)
MsgBox petittiti
moyentiti = tablo(1)
MsgBox moyentiti
grandtiti = tablo(2)
MsgBox grandtiti
grandtiti = tablo(UBound(tablo))
MsgBox grandtiti
5
Polux31 Messages postés 6917 Date d'inscription mardi 25 septembre 2007 Statut Membre Dernière intervention 1 novembre 2016 1 204
21 déc. 2009 à 14:01
Bonjour,

Tu peux faire comme ça:

If Instr(1,machaine, ",") <> 0 Then
     mTab = Split(machaine, ",")
End If


;o)
3
analog101 Messages postés 173 Date d'inscription mardi 1 avril 2008 Statut Membre Dernière intervention 25 février 2020 3
21 déc. 2009 à 13:50
Super merci!

Je dois aussi détécter si une virgule est présente dans ma chaine de départ par ex "toto, tata" mais je ne sait pas trop comment m'y prendre.

Qq un peut m'aider ?
2