Function Sans_Point(pChaine As String) As String
' pour tous les "mots" finissant par ".", on remplace par " "
' ex : Mot1. Mot2. suite et fin
' -> Mot1 Mot2 suite et fin
Dim Mot As Variant
Dim i As Integer
Mot = Split(pChaine, " ")
For i = LBound(Mot) To UBound(Mot)
If Right(Mot(i), 1) = "." Then Mot(i) = Left(Mot(i), Len(Mot(i)) - 1)
Next i
Sans_Point = Join(Mot, " ")
End Function
Function Epure(pChaine As String) As String
Dim Chaine As String
' remplacement des caractères accentués
Chaine = pChaine
Epure = Sans_Accent(Chaine)
' suppression des caractères autres que numériques (0,1,2,...9) qu'alphabétiques non accentués (a,b,...z A,B,...Z)
Epure = Sans_Special(Chaine)
End Function
Function Sans_Accent(pChaine As String) As String
Dim ListeAccent As String
Dim ListeSansAccent As String
Dim i As Integer
Dim pos
Dim Chaine As String
' remplacement des caractères accentués
ListeAccent = "ÀÁÂÃÄÅÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåèéêëìíîïðñòóôõöùúûüýÿ"
ListeSansAccent = "AAAAAAEEEEIIIINOOOOOUUUUYaaaaaaeeeeiiiionooooouuuuyy"
For i = 1 To Len(pChaine)
pos = InStr(1, ListeAccent, Mid(pChaine, i, 1), 0)
If pos > 0 Then
Mid(pChaine, i, 1) = Mid(ListeSansAccent, pos, 1)
End If
Next i
Sans_Accent = pChaine
End Function
Public Function Sans_Special(pChaine As String) As String
Dim i As Integer
Dim j As Integer
Dim Chaine As String
' suppression des caractères autres que numériques (0,1,2,...9) qu'alphabétiques non accentués (a,b,...z A,B,...Z)
j = 0
Chaine = ""
For i = 1 To Len(pChaine)
If ( _
(Asc(Mid(pChaine, i, 1)) >= Asc("a")) And (Asc(Mid(pChaine, i, 1)) <= Asc("z")) Or _
(Asc(Mid(pChaine, i, 1)) >= Asc("A")) And (Asc(Mid(pChaine, i, 1)) <= Asc("Z")) Or _
(Asc(Mid(pChaine, i, 1)) >= Asc("0")) And (Asc(Mid(pChaine, i, 1)) <= Asc("9")) Or _
(Mid(pChaine, i, 1) = " ") _
) _
Then
j = j + 1
Chaine = Chaine & Mid(pChaine, i, 1)
Else
End If
Next i
Sans_Special = Chaine
End Function