- Function getMot(chaine As String, mot As Integer)
-
- 'Declation des variables
- Dim mots(200) As String
- Dim ok As Boolean
- Dim compteur As Integer
-
- 'initialisation des variables
- ok = False
- compteur = 0
- 'debut de la programmation
- If InStr(chaine, " ") > 0 Then
- While (ok = False)
- compteur = compteur + 1
- If InStr(chaine, " ") > 0 Then
- If compteur < 200 Then 'Si compteur de mots inférieur a 200..
- mots(compteur) = Left(chaine, InStr(chaine, " ") - 1)
- chaine = Right(chaine, Len(chaine) - InStr(chaine, " "))
- While (Left(chaine, 1) = " ")
- chaine = Right(chaine, Len(chaine) - 1)
- Wend
- Else 'Sinon + de 200, fermeture de la boucle..
- ok = True
- End If
- Else
- While (Right(chaine, 1) = " ")
- chaine = Left(chaine, Len(chaine) - 1)
- Wend
- mots(compteur) = chaine
- ok = True
- End If
- Wend
- End If
-
- If mot <= compteur Then
- getMot = mots(mot)
- Else
- getMot = 0
- End If
- End Function
Function getMot(chaine As String, mot As Integer)
'Declation des variables
Dim mots(200) As String
Dim ok As Boolean
Dim compteur As Integer
'initialisation des variables
ok = False
compteur = 0
'debut de la programmation
If InStr(chaine, " ") > 0 Then
While (ok = False)
compteur = compteur + 1
If InStr(chaine, " ") > 0 Then
If compteur < 200 Then 'Si compteur de mots inférieur a 200..
mots(compteur) = Left(chaine, InStr(chaine, " ") - 1)
chaine = Right(chaine, Len(chaine) - InStr(chaine, " "))
While (Left(chaine, 1) = " ")
chaine = Right(chaine, Len(chaine) - 1)
Wend
Else 'Sinon + de 200, fermeture de la boucle..
ok = True
End If
Else
While (Right(chaine, 1) = " ")
chaine = Left(chaine, Len(chaine) - 1)
Wend
mots(compteur) = chaine
ok = True
End If
Wend
End If
If mot <= compteur Then
getMot = mots(mot)
Else
getMot = 0
End If
End Function