Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

fonction split

2 réponses
Avatar
DAMS
Bonjour =E0 tous,
J'ai un probl=E8me avec ma fonction split. J'ai un endroit dans mon
split o=F9 j'ai deux fois de suite un Null. voir exemple ci dessous:
voici ce que j'ai dans un "Champ" dans une table

1::::toto tata :titi:::::

en fait je fais

dim matrice as variant
dim matrice2 as variant

matrice=3Dsplit(Champ,":")
matrice2=3Dsplit(matrice(4),chr(9)) 'chr(9) car valeur s=E9parer par des
tabulations 9 code ascii de tabulations
a=3Dmatrice2(0)
b=3Dmatrice2(1)
c=3Dmatrice2(2)
d=3Dmatrice2(3)

avec ce code j'ai bien
a=3Dtoto
b=3Dtata
c=3D
d=3D"ici j'ai mon probl=E8me il me dis qu'il y a une erreur de type, est-
ce que cela peut provenir du fait qu'il y est deux Null qui se
suivent?

merci =E0 tous pour votre aide
Damien

2 réponses

Avatar
Eric
Bonjour,

Je n'ai pas ton problème en faisant une simulation avec ton exemple;

avec matrice2=split(matrice(4),chr(9))

For i = lbound(matrice2) to ubound(matrice2)
debug.print i, matrice2(i)
Next i

j'obtiens :
0 toto
1 tata
2
3

Es-tu sur qu'il y a bien 2 tabulations à la suite ou un autre caractère
non visualisable

Bonjour à tous,
J'ai un problème avec ma fonction split. J'ai un endroit dans mon
split où j'ai deux fois de suite un Null. voir exemple ci dessous:
voici ce que j'ai dans un "Champ" dans une table

1::::toto tata :titi:::::

en fait je fais

dim matrice as variant
dim matrice2 as variant

matrice=split(Champ,":")
matrice2=split(matrice(4),chr(9)) 'chr(9) car valeur séparer par des
tabulations 9 code ascii de tabulations
a=matrice2(0)
b=matrice2(1)
c=matrice2(2)
d=matrice2(3)

avec ce code j'ai bien
a=toto
b=tata
c > d="ici j'ai mon problème il me dis qu'il y a une erreur de type, est-
ce que cela peut provenir du fait qu'il y est deux Null qui se
suivent?

merci à tous pour votre aide
Damien



--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr

Avatar
Eric
.../...
Exemple peut-être pas probant car j'ai reconstruit la chaine avec des chr(9)

Bonjour,

Je n'ai pas ton problème en faisant une simulation avec ton exemple;

avec matrice2=split(matrice(4),chr(9))

For i = lbound(matrice2) to ubound(matrice2)
debug.print i, matrice2(i)
Next i

j'obtiens :
0 toto
1 tata
2
3

Es-tu sur qu'il y a bien 2 tabulations à la suite ou un autre caractère
non visualisable

Bonjour à tous,
J'ai un problème avec ma fonction split. J'ai un endroit dans mon
split où j'ai deux fois de suite un Null. voir exemple ci dessous:
voici ce que j'ai dans un "Champ" dans une table

1::::toto tata :titi:::::

en fait je fais

dim matrice as variant
dim matrice2 as variant

matrice=split(Champ,":")
matrice2=split(matrice(4),chr(9)) 'chr(9) car valeur séparer par des
tabulations 9 code ascii de tabulations
a=matrice2(0)
b=matrice2(1)
c=matrice2(2)
d=matrice2(3)

avec ce code j'ai bien
a=toto
b=tata
c >> d="ici j'ai mon problème il me dis qu'il y a une erreur de type, est-
ce que cela peut provenir du fait qu'il y est deux Null qui se
suivent?

merci à tous pour votre aide
Damien





--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr