WinRT 中是否有 String.Normalize() 替代方案? [英] Is there String.Normalize() alternative in WinRT?

查看:30
本文介绍了WinRT 中是否有 String.Normalize() 替代方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WinRT 中是否有 string.Normalize() 的替代方法?我想简单地使用 这种方法从输入字符串中删除重音符号,但是我在 WinRT 中找不到任何这种方法.

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.

推荐答案

我发现了 此处 快速而简短的解决方案,在 WinRT 中运行良好:

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);
}

这篇关于WinRT 中是否有 String.Normalize() 替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆