2016-10-23 19:14:57 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Extensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class BaseExtensions
|
|
|
|
|
/// </summary>
|
2016-10-23 19:47:34 +00:00
|
|
|
|
public static class StringExtensions
|
2016-10-23 19:14:57 +00:00
|
|
|
|
{
|
|
|
|
|
public static string RemoveDiacritics(this string text)
|
|
|
|
|
{
|
|
|
|
|
return String.Concat(
|
|
|
|
|
text.Normalize(NormalizationForm.FormD)
|
|
|
|
|
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
|
|
|
|
|
UnicodeCategory.NonSpacingMark)
|
|
|
|
|
).Normalize(NormalizationForm.FormC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|