Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 202174 6 sept. 2003 à 15:27
on peut aussi faire ainsi :
• lier la reference 'Microsoft VbScript Regular Expression 5.5'
Private Sub Command1_Click()
Dim REG As New RegExp
Dim Matches As MatchCollection
REG.Global = True
REG.Pattern = "[^s""',.?!;€$£?:%+-*/\§<>{}([)]]+"
Set Matches = REG.Execute(Text1.Text)
MsgBox Matches.Count & " mots."
End Sub
--------------------
attention, ce code fonctionne chez moi, mais je ne sais pas si les Slashes et BackSlashes s'afficheront correctement sur vbfrance.....
11 sept. 2006 à 20:09
Public Function CountWord(Text As String, word As String) As Integer
CountWord = (Len(Text) - Len(Replace(Text, word, ""))) / Len(word)
End Function
:)
1 juin 2005 à 21:31
6 sept. 2003 à 16:10
jvais voir ça...
6 sept. 2003 à 15:53
pour compter les mots ya un truc immediat et bcp plus simple ;)
NbreDeMots = (UBound(Split(Text1.Text, " ", , vbTextCompare)) +1)
c pas plus simple ça hein ?
6 sept. 2003 à 15:31
je refait un essai, en doublant les bslashes !
REG.Pattern = "[^\s""',.?!;€\$£?:%\+\-\*\/\\§<>\{\}\(\[\)\]]+"
6 sept. 2003 à 15:27
• lier la reference 'Microsoft VbScript Regular Expression 5.5'
Private Sub Command1_Click()
Dim REG As New RegExp
Dim Matches As MatchCollection
REG.Global = True
REG.Pattern = "[^s""',.?!;€$£?:%+-*/\§<>{}([)]]+"
Set Matches = REG.Execute(Text1.Text)
MsgBox Matches.Count & " mots."
End Sub
--------------------
attention, ce code fonctionne chez moi, mais je ne sais pas si les Slashes et BackSlashes s'afficheront correctement sur vbfrance.....