博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
string转Unicode
阅读量:7290 次
发布时间:2019-06-30

本文共 625 字,大约阅读时间需要 2 分钟。

1、来自网络

public static byte[] setByte2(string str, int len)        {            byte[] b = Encoding.Default.GetBytes(str);            byte[] unicodeBytes = Encoding.Convert(Encoding.Default, Encoding.Unicode, b);            //MessageBox.Show(unicodeBytes.Length.ToString());            byte[] s = new byte[len];            for (int i = 0; i < unicodeBytes.Length; i++)            {                s[i] = unicodeBytes[i];            }            for (int i = unicodeBytes.Length; i < len; i++)            {                s[i] = 0;            }            return s;        }

 

2、

 

转载于:https://www.cnblogs.com/csskill/p/5546380.html

你可能感兴趣的文章
静态页面跳转传值小插件
查看>>
JetBrains公司的IDE使用技巧
查看>>
第三届中国云计算用户大会笔记和心得
查看>>
PHP7开启opcache打造强悍性能
查看>>
加载某个页面(A)时实现自动跳转到某个页面(B)
查看>>
Jenkins入门系列之——03PDF文档下载
查看>>
Digit Generator(生成元)
查看>>
php 入门笔记
查看>>
Python3.7安装PyQt5的方法
查看>>
Zoj 3781(构造)
查看>>
One error related to msxml4.dll (0x800C0014)
查看>>
“爆打”团队阿尔法发布 以及 第四周任务
查看>>
【堆】bzoj1293 [SCOI2009]生日礼物
查看>>
JavaScript的异步运行机制
查看>>
centos7安装HTTPS协议
查看>>
GNS3 模拟icmp端口不可达
查看>>
hdu 5677 ztr loves substring 多重背包
查看>>
WCF学习
查看>>
django 基础进 COOKIE
查看>>
[Java 8] (10) 使用Lambda完成函数组合,Map-Reduce以及并行化
查看>>