I’m having trouble removing accents in the string

Asked

Viewed 39 times

-1

I need to remove accents from the string.

I need to take to convert URL in BD.

From to > the

1 answer

2

public static string removerAcentos(string texto)
{
    string Acentos = "ÄÅÁÂÀÃäáâàãÉÊËÈéêëèÍÎÏÌíîïìÖÓÔÒÕöóôòõÜÚÛüúûùÇç";
    string semAcentos = "AAAAAAaaaaaEEEEeeeeIIIIiiiiOOOOOoooooUUUuuuuCc";

    for (int i = 0; i < Acentos.Length; i++)
    {
        texto = texto.Replace(Acentos[i].ToString(), semAcentos[i].ToString());
    }
    return texto;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.