Private Const ACCENT As String = “ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç”
Private Const SANSACCENT As String = “AAAAAAaaaaaaOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNnCc”
Public Shared Function FormatForUrl(ByVal uriBase As String) As String
If String.IsNullOrEmpty(uriBase) Then
Return uriBase
End If
‘// Declaration de variables
Dim chaine As String = uriBase.Trim.Replace(” “, “-”)
chaine = chaine.Replace(” “c, “-”c)
chaine = chaine.Replace(“–”, “-”)
chaine = chaine.Replace(“‘”c, String.Empty)
chaine = chaine.Replace(“?”c, String.Empty)
chaine = chaine.Replace(“#”c, String.Empty)
chaine = chaine.Replace(“:”c, String.Empty)
chaine = chaine.Replace(“;”c, String.Empty)
‘// Conversion des chaines en tableaux de caractŠres
Dim tableauSansAccent As Char() = SANSACCENT.ToCharArray
Dim tableauAccent As Char() = ACCENT.ToCharArray
‘// Pour chaque accent
For i As Integer = 0 To ACCENT.Length – 1
‘ // Remplacement de l’accent par son ‚quivalent sans accent dans la chaŒne de caractŠres
chaine = chaine.Replace(tableauAccent(i).ToString(), tableauSansAccent(i).ToString())
Next
‘// Retour du resultat
Return chaine
End Function