unicode转中文 C# (dotnetcore)
unicode转中文 C#
unicode转中文 (dotnetcore)
需要引用:using System.Text.RegularExpressions;
使用语言:C#
环境:.net core 2.1 (当前使用)
核心方法:
Regex.Unescape();
核心代码:
string str1 = "\u9759\u6b62\u7684";
string strCov = Regex.Unescape(str1);
System.Console.WriteLine(strCov);
全部代码:
using System;
using System.Text.RegularExpressions;
namespace netcore.regex_unescape.demo
{
class Program
{
static void Main(string[] args)
{
//using System.Text.RegularExpressions;
// 我们需要使用Regex 来转换他们,unescape这个方法可以把unicode转中文
string str1 = "\u9759\u6b62\u7684";
string strCov = Regex.Unescape(str1);
System.Console.WriteLine(strCov);
}
}
}