1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Dim tb,tbTri,st1,st2
Dim i, j
st1 = "CN=TOTO,OU=x,...,OU=1,DC=DOMAINE,DC=COM"
tb = split(st1,",")
tbTri = Array("DC=COM","DC=DOMAINE","OU=","CN=")
Wscript.Echo "Lance tri"
For i = 0 to uBound (tbTri) 'Parcours du tableau donnant l'ordre de tri
Wscript.Echo "TRI ------------ : " & tbTri(i)
For j = 0 to Ubound (tb) 'Parcours tableau données à trier.
Wscript.Echo "Teste " & tb(J)
if InStr(1,tb(j),tbTri(i),1 ) > 0 then
Wscript.Echo " ====================> " & tb(J)
if st2 <> "" then st2 = st2 & ","
st2 = st2 & tb(J)
tb(J) = ""
end if
Next
next
'Ajout des chaines restante, l'on conserve l'ordre existant
For j = 0 to Ubound (tb) 'Parcours tableau
Wscript.Echo "Teste " & tb(J)
if tb(j)<> "" then
Wscript.Echo " ====================> " & tb(J)
if st2 <> "" then st2 = st2 & ","
st2 = st2 & tb(J)
tb(J) = ""
end if
Next
Wscript.Echo " RESULTAT " :
WScript.ECho "[" & st1 & "] ==> [" & st2 & "]" |
Partager