PCPT
Messages postés13280Date d'inscriptionlundi 13 décembre 2004StatutMembreDernière intervention 3 février 201848 21 oct. 2005 à 21:02
salut,
voici une solution fonctionnelle VB6
ps : Econs -> ta solution ne fonctionne pas (pas chez moi en tout cas )
Private Sub Command1_Click()
' !!!! ne prend pas en compte chiffres et caractères spéciaux et accentués
' (donc considérés comme consonnes)
If Text1.Text = "" Then Exit Sub
Select Case LCase (Left$(Text1.Text, 1))
Case "a", "e", "i", "o", "u", "y": Exit Sub
End Select
Dim i As Integer, iCpt As Integer
iCpt = 0
For i = 1 To Len (Text1.Text)
Select Case LCase(Mid(Text1.Text, i, 1))
Case "a", "e", "i", "o", "u", "y": Exit For
Case Else: iCpt = iCpt + 1
End Select
Next i
MsgBox "il y a " & iCpt & " consonnes consécutives", 32
End Sub
cs_hassen
Messages postés338Date d'inscriptionmardi 28 janvier 2003StatutMembreDernière intervention 4 novembre 2008 22 oct. 2005 à 16:44
Public Function nbConsonnes(s As String) As Long
dim i as byte
const voyelle ="eauioy"
nb=0
s=Lcase(s)
for i=1 to len(voyelle)
if nb>instr(1,s,mid(voyelle,i,1)) then nb=instr(1,s,mid(voyelle,i,1))
next i
nbConsonnes=nb
end function
j'ai pas tester sur visual basic mais je croit que ca marche.
faut juste essayer