Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Removing accents in NET 2.0 with C# (See related posts)

Removing accents in NET 2.0

static string UrlSanitize(string url)
{
	url = Regex.Replace(url, @"\s+", "-");
	string stFormD = url.Normalize(NormalizationForm.FormD);
	StringBuilder sb = new StringBuilder();
 
	for (int ich = 0; ich < stFormD.Length; ich++)
	{
		UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(stFormD[ich]);
		if (uc != UnicodeCategory.NonSpacingMark)
		{
			sb.Append(stFormD[ich]);
		}
	}
 
	return (sb.ToString());
}

Comments on this post

jcongote posts on Sep 25, 2006 at 22:28
Hello, maybe this is not c code, is csharp, it's better to use csharp label.

You need to create an account or log in to post comments to this site.


Click here to browse all 4863 code snippets

Related Posts