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

About this user

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Removing accents in NET 2.0 with C#

Removing accents in NET 2.0

   1  
   2  static string UrlSanitize(string url)
   3  {
   4  	url = Regex.Replace(url, @"\s+", "-");
   5  	string stFormD = url.Normalize(NormalizationForm.FormD);
   6  	StringBuilder sb = new StringBuilder();
   7   
   8  	for (int ich = 0; ich < stFormD.Length; ich++)
   9  	{
  10  		UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(stFormD[ich]);
  11  		if (uc != UnicodeCategory.NonSpacingMark)
  12  		{
  13  			sb.Append(stFormD[ich]);
  14  		}
  15  	}
  16   
  17  	return (sb.ToString());
  18  }
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS