首页 > 其他 > 详细

汉字转为Unicode编码

时间:2014-08-21 19:01:44      阅读:342      评论:0      收藏:0      [点我收藏+]
   protected string GetUnicode(string text)
    {
        string result = "";
        for (int i = 0; i < text.Length; i++)
        {
            if ((int)text[i] > 32 && (int)text[i] < 127)
            {
                result += text[i].ToString();
            }
            else
                result += string.Format("\\u{0:x4}", (int)text[i]);
        }
        return result;
    }

 

汉字转为Unicode编码,布布扣,bubuko.com

汉字转为Unicode编码

原文:http://www.cnblogs.com/haozhenjie819/p/3927805.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!