Is there String.Normalize() alternative in WinRT?

2019-07-04 09:25发布

Is there any alternative to string.Normalize() in WinRT? I want to simply remove accents from input strings using this approach, but I cannot find anywhere this method in WinRT.

2条回答
乱世女痞
2楼-- · 2019-07-04 09:35

I've discovered here quick and short solution, that works just fine in 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);
}
查看更多
劫难
3楼-- · 2019-07-04 09:40

You will not find any alternative to String.Normalize in WinRT because it is available as part of the .NET Core Profile that is available to Metro style apps. Docs. If you are using C++, see this question.

查看更多
登录 后发表回答