- 声望
- 0 点
- 西工币
- 538 枚
- 贡献值
- 0 点
- 好评度
- 0 点
- 最后登录
- 2008-7-7
- 注册时间
- 2008-5-29
- 帖子
- 53
- 精华
- 0
- 积分
- 53
- 阅读权限
- 30
- UID
- 15738
 
该用户从未签到 - 西工币
- 538 枚
- 好评度
- 0 点
- 声望
- 0 点
- 注册时间
- 2008-5-29
- 帖子
- 53
- 积分
- 53
- UID
- 15738
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
namespace ConsoleApplication2
{
class Program
{
static string UnicodeToString(string srcstr)
{
string ret = "";
string src = srcstr;
int len = srcstr.Length / 4;
for (int i = 0; i <= len - 1; i++)
{
string str = "";
str = src.Substring(0,4);
src = src.Substring(4);
if(有非法字符)
{
continue;
}
else
{
ret+=((char)int.Parse(str, System.Globalization.NumberStyles.HexNumber)).ToString();
}
}
return ret;
}
static void Main(string[] args)
{
Console.WriteLine("请输入Unicode字符串:");
string str = Console.ReadLine();
Console.WriteLine("转化结果为:{0}", UnicodeToString(str));
Console.ReadKey();
}
}
} |
|