Réponse acceptée !
Bonjour,
Ton problème est assez simple. Cest juste le fait de trouver un point commun dans la chaîne que tu as et la visiblement pour ton channel cest les espaces.
Alors moi jai fait ma propre routine de découpage, mais tu peu aussi utiliser la fonction « split ».
Cela donnerais dans ton cas.
Private Sub Command1_Click()
' DECLARATION DES VARIABLES.
Dim lngIAs Long
Dim strScanAs String
Dim strTempsAs String
Dim strResult() As String
' DECOUPAGE DE LA VARIABLE.
strTemps = ":GaaraS`OqP PRIVMSG #ZanmaTo :ceci est un test"
If Mid$(strTemps, &H1, &H1) = ":" Then
strTemps = Mid$(strTemps, &H2, Len(strTemps) - &H1)
End If
For lngI = &H2 To Len(strTemps)
strScan = Mid$(strTemps, lngI, &H1)
If strScan = ":" Then
strScan = Mid$(strTemps, lngI + &H1, Len(strTemps) - lngI)
Exit For
End If
Next lngI
Call StringDecoupe(Mid$(strTemps, &H1, lngI - 1), " ", strResult())
' AFFICHAGE DU RESULTAT.
For lngI = &H1 To UBound(strResult())
MsgBox (strResult(lngI))
Next lngI
MsgBox (strScan)
End Sub
Private Sub StringDecoupe(ByVal strLine As String, ByVal strSeparator As String, ByRef strResult() As String)
' DECLARATION DES VARIABLES.
Dim lngIAs Long ' VARIABLE TEMPORAIRE.
Dim lngJAs Long ' VARIABLE TEMPORAIRE.
Dim lngUAs Long ' VARIABLE TEMPORAIRE.
' INITIALISATION DU TABLEAU DE RESULTAT.
ReDim lngResult(&H1 To &H1) As String
' DECOUPE DE LA CHAINE DE CARACTERE.
lngJ = &H1
For lngI = &H1 To Len(strLine) Step &H1
If Mid$(strLine, lngI, Len(strSeparator)) = strSeparator Then
lngU = lngU + &H1
ReDim Preserve strResult(&H1 To lngU) As String
strResult(lngU) = Mid$(strLine, lngJ, (lngI - &H1) - (lngJ - Len(strSeparator)))
lngJ = lngI + Len(strSeparator)
End If
Next lngI
If Right(strLine, Len(strSeparator)) <> strSeparator Then
lngU = lngU + &H1
ReDim Preserve strResult(&H1 To lngU) As String
strResult(lngU) = Mid$(strLine, lngJ, Len(strLine) - (lngJ - Len(strSeparator)))
End If
End Sub
Bon jai fait cela vite fait, alors y a surement des optimisations a faire mais cela te permettra de comprendre un peu mieu.
A++
[Gally Home Corp]