function convertirURLfriendly(cadena) if not isNull(cadena) then ' Eliminamos los espacios a ambos lados de la cadena strCadena = Trim(lCase(cadena)) ' Reemplazamos carácteres especiales strCadena = replace(replace(strCadena,"'",""),"""","") strCadena = replace(replace(strCadena,""",""),vbcrlf,"") strCadena = replace(replace(strCadena,"<br>","")," ","-") set expReg = New RegExp ' Todas las ocurrencias expReg.Global = True expReg.Pattern = "[àáâãäå]" strCadena = expReg.Replace(strCadena, "a") expReg.Pattern = "[èéêë]" strCadena = expReg.Replace(strCadena, "e") expReg.Pattern = "[ìíîï]" strCadena = expReg.Replace(strCadena, "i") expReg.Pattern = "[òóôõö]" strCadena = expReg.Replace(strCadena, "o") expReg.Pattern = "[ùúûü]" strCadena = expReg.Replace(strCadena, "u") expReg.Pattern = "[ñ]" strCadena = expReg.Replace(strCadena, "n") expReg.Pattern = "[ç]" strCadena = expReg.Replace(strCadena, "c") ' Todo lo que no cumpla este patron expReg.Pattern = "[^a-z0-9-]" strCadena = expReg.Replace(strCadena, "") set expReg = nothing convertirAURLfriendly = left(strCadena,256) else convertirAURLfriendly = "" end if end function
Categorías