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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| Public Sub Form_Load()
Dim strApp(100)
Dim strEmer(100, 20)
Dim strUsr(100, 20)
sFile = "C:\essai.txt"
Fnum = FreeFile()
Open sFile For Input As #Fnum
nIndex = 0
nRec = 0
Do While Not EOF(Fnum)
Input #1, tData
tAryRecord = Split(tData, ";")
' Nom de l'application
strApp(nRec) = tAryRecord(0)
' Nombre des comptes Emergency
nCount = 0
rCode = fDelimiterCount(tAryRecord(1), "@", nCount)
' Séparation des Comptes
tAryEmerg = Split(tAryRecord(1), "/")
For i = 0 To nCount - 1
strEmer(nRec, i) = tAryEmerg(i)
Next
' Nombre d'Utilisateurs
nCount = 0
rCode = fDelimiterCount(tAryRecord(2), "/", nCount)
If nCount = 0 Then nCount = 1
' Séparation des Comptes
tAryUsr = Split(tAryRecord(2), "/")
For i = 0 To nCount - 1
strUsr(nRec, i) = tAryUsr(i)
Next
nRec = nRec + 1
Loop
Close Fnum
End Sub
Private Function fDelimiterCount(ByRef strData, ByRef chrSeparator, ByRef nCount) As Integer
nCount = 0
nLenght = Len(strData)
For i = 1 To nLenght
If Mid(strData, i, 1) = chrSeparator Then
nCount = nCount + 1
End If
Next
End Function |
Partager