Return to Snippet

Revision: 8391
at September 18, 2008 04:45 by sulfurito


Initial Code
'Cambia los caracteres con tildes, ñ, ç por letras sin tilde o N o C
    'Elimina las tilde spor completo, puede ser necesario al pasar datos
    'desde UTF-8 a sistemas con ISO-8859-1
     Function quitaTildes(texto)
        If not EsNulo(texto) Then
            texto = Replace(texto, "¡", "", 1, Len(texto), 1)
            texto = Replace(texto, "¿", "", 1, Len(texto), 1)
            texto = Replace(texto, "'", "", 1, Len(texto), 1)

            Texto = Replace(Texto, "á", "a", 1, Len(Texto), 1)
            Texto = Replace(Texto, "é", "e", 1, Len(Texto), 1)
            Texto = Replace(Texto, "í", "i", 1, Len(Texto), 1)
            Texto = Replace(Texto, "ó", "o", 1, Len(Texto), 1)
            Texto = Replace(Texto, "ú", "u", 1, Len(Texto), 1)
            Texto = Replace(Texto, "ñ", "n", 1, Len(Texto), 1)
            texto = Replace(texto, "ç", "c", 1, Len(texto), 1)

            texto = Replace(texto, "Á", "A", 1, Len(texto), 1)
            texto = Replace(texto, "É", "E", 1, Len(texto), 1)
            texto = Replace(texto, "Í", "I", 1, Len(texto), 1)
            texto = Replace(texto, "Ó", "O", 1, Len(texto), 1)
            texto = Replace(texto, "Ú", "U", 1, Len(texto), 1)
            texto = Replace(texto, "Ñ", "N", 1, Len(texto), 1)
            texto = Replace(texto, "Ç", "C", 1, Len(texto), 1)

            texto = Replace(texto, "à", "a", 1, Len(Texto), 1)
            texto = Replace(texto, "è", "e", 1, Len(Texto), 1)
            texto = Replace(texto, "ì", "i", 1, Len(Texto), 1)
            texto = Replace(texto, "ò", "o", 1, Len(Texto), 1)
            texto = Replace(texto, "ù", "u", 1, Len(Texto), 1)
                                        
            texto = Replace(texto, "À",  "A", 1, Len(texto), 1) 
            texto = Replace(texto, "È",  "E", 1, Len(texto), 1) 
            texto = Replace(texto, "Ì",  "I", 1, Len(texto), 1) 
            texto = Replace(texto, "Ã’",  "O", 1, Len(texto), 1) 
            texto = Replace(texto, "Ù",  "U", 1, Len(texto), 1) 

            texto = Replace(texto, "ä", "a", 1, Len(Texto), 1)
            texto = Replace(texto, "ë", "e", 1, Len(Texto), 1)
            texto = Replace(texto, "ï", "i", 1, Len(Texto), 1)
            texto = Replace(texto, "ö", "o", 1, Len(Texto), 1)
            texto = Replace(texto, "ü", "u", 1, Len(Texto), 1)

            texto = Replace(texto, "Ä",  "A", 1, Len(texto), 1) 
            texto = Replace(texto, "Ë",  "E", 1, Len(texto), 1) 
            texto = Replace(texto, "Ï",  "I", 1, Len(texto), 1) 
            texto = Replace(texto, "Ö",  "O", 1, Len(texto), 1) 
            texto = Replace(texto, "Ü",  "U", 1, Len(texto), 1) 

            texto = Replace(texto, "â", "a", 1, Len(Texto), 1)
            texto = Replace(texto, "ê", "e", 1, Len(Texto), 1)
            texto = Replace(texto, "î", "i", 1, Len(Texto), 1)
            texto = Replace(texto, "ô", "o", 1, Len(Texto), 1)
            texto = Replace(texto, "û", "u", 1, Len(Texto), 1)

            texto = Replace(texto, "Â",  "A", 1, Len(texto), 1) 
            texto = Replace(texto, "Ê",  "E", 1, Len(texto), 1) 
            texto = Replace(texto, "ÃŽ",  "I", 1, Len(texto), 1) 
            texto = Replace(texto, "Ô",  "O", 1, Len(texto), 1) 
            texto = Replace(texto, "Û",  "U", 1, Len(texto), 1) 
       Else
            texto = ""
        End If
        quitaTildes = texto
    End Function

Initial URL


Initial Description
Take out accents
Quitar tildes

Initial Title
Accents/tildes to normal character

Initial Tags


Initial Language
ASP