WinRT 中是否有 string.Normalize() 的替代方案?我想简单地使用从输入字符串中删除重音符号这种方法 https://stackoverflow.com/questions/4046937/removing-diacritics-in-silverlight-string-normalize-issue,但我在WinRT中找不到任何地方这个方法。
我发现了here https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net快速而简短的解决方案,在 WinRT 中运行良好:
public static string RemoveAccents(this string accentedStr)
{
byte[] tempBytes = Encoding.GetEncoding("ISO-8859-8").GetBytes(accentedStr);
return Encoding.UTF8.GetString(tempBytes, 0, tempBytes.Length);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)