当前位置:网站首页>C string to short[] method
C string to short[] method
2022-07-28 19:22:00 【Susan flower rain】
STRING TO SHORT[] Method
public short[] stringToShort(String inString, out short[] outShort)
{
if (inString.Length % 2 == 1) {
inString += " "; }
char[] bufChar = inString.ToCharArray();
byte[] oufByte = Encoding.Default.GetBytes(bufChar); // new byte[bufChar.Length];
byte[] bufByte = new byte[2];
outShort = new short[bufChar.Length / 2];
for (int i = 0, j = 0; i < bufChar.Length; i += 2, j++)
{
bufByte[0] = oufByte[i];
bufByte[1] = oufByte[i + 1];
outShort[j] = BitConverter.ToInt16(bufByte, 0);
}
return outShort;
}
private void button1_Click(object sender, EventArgs e)
{
short[] arr2 = new short[16];
String inString = "12ABCDEFGHIJKLMNOPQRSTUVWXYZPP34";
stringToShort(inString, out arr2);
}
边栏推荐
- FTM module of K60: configure motor, encoder and steering gear
- uwb模块实现人员精确定位,超宽带脉冲技术方案,实时厘米级定位应用
- vim学习手册
- TSDB and blockchain
- unity CS1513
- Share several coding code receiving verification code platforms, which will be updated in February 2022
- Pytorch GPU yolov5 reports an error
- Kotlin Android development novice tutorial
- [image hiding] digital image information hiding system based on DCT, DWT, LHA, LSB, including various attacks and performance parameters, with matlab code
- 关于白盒测试,这些技巧你得游刃有余~
猜你喜欢

Fantasy 5 (ue5) game engine complete course 2022

BM11 链表相加(二)

力扣 1331. 数组序号转换

How to write a JMeter script common to the test team

1、 My first wechat applet

ICLR21(classification) - 未来经典“ViT” 《AN IMAGE IS WORTH 16X16 WORDS》(含代码分析)

【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码

uwb模块实现人员精确定位,超宽带脉冲技术方案,实时厘米级定位应用

Creating new projects and adding your own programs

剑指 Offer II 109. 开密码锁
随机推荐
Time waits for no man. The rise of TSDB is at the right time
Pytorch:快速求得NxN矩阵的主对角线(diagonal)元素与非对角线元素
【物理应用】大气吸收损耗附matlab代码
Solve the critical path in FJSP - with Matlab source code
Using CPLEX to solve small-scale energy-efficient FJSP
Self-adaptive multi-objective evolutionary algorithm for flexible job shop scheduling with fuzzy pro
Kali doesn't have an eth0 network card? What if you don't connect to the Internet
More loading in applets (i.e. list paging)
Server body 21: pre compilation processing by different compilers (a brief introduction to MSVC and GCC)
How long does software testing take?
As for the white box test, you have to be skillful in these skills~
ECS 5 workflow
[machine learning] support vector machine classification
Cv5200 wireless WiFi communication module, wireless video image transmission, real-time wireless communication technology
Share several coding code receiving verification code platforms, which will be updated in February 2022
软件测试开发基础|测开中的几个工具开发实战
VAE:变分自编码器的理解与实现
Gmoea code operation 2 -- establishment and operation of operation environment
Parity rearrangement of Bm14 linked list
Application value of MES production management system to equipment