111,010
社区成员
发帖
与我相关
我的任务
分享
string 设备名称_CODE = "\u6D77\u66D9_ONU_726";
\u6D77\u66D9_ONU_726
class MainClass
{
public static void Main(string[] args)
{
using (StreamReader sr = new StreamReader(@".\test.txt", UnicodeEncoding.Default))
{
string str = sr.ReadLine();
Console.WriteLine(str);
Regex reg = new Regex(@"(\\u[0-9a-fA-F]{4})");
string result = reg.Replace(str, new MatchEvaluator(new MainClass().Hex2Unicode));
Console.WriteLine(result);
}
}
public string Hex2Unicode(Match m)
{
return ((char)(int.Parse(m.Value.Substring(2),NumberStyles.HexNumber))).ToString();
}
}
\u6D77\u66D9_ONU_726
海曙_ONU_726
Regex reg = new Regex(@"\u[0-9a-fA-F]{4})+");
StreamReader sw = new StreamReader(@"DDDD.txt", UnicodeEncoding.Default);
StreamReader sw = new StreamReader(@"DDDD.txt");
string html = sw.ReadToEnd();