当前位置:网站首页>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);
}
边栏推荐
- Getting started with QT & OpenGL
- Pytorch GPU yolov5 reports an error
- Adobe Flash player 34.0.0.92 and available version modification methods (2021-01-23
- Streamlit machine learning application development tutorial
- 当CNN遇见Transformer《CMT:Convolutional Neural Networks Meet Vision Transformers》
- 2、 Uni app login function page Jump
- Tikz draw Gantt chart in FJSP -trans necessary
- Validate hardware DDR design with Xilinx MIG
- 关于ASM冗余问题
- Fundamentals of software testing and development | practical development of several tools in testing and development
猜你喜欢

软件测试开发基础|测开中的几个工具开发实战

Structure and working principle of thyristor

优麒麟系统安装BeyondComare

【物理应用】水下浮动风力涡轮机的尾流诱导动态模拟风场附matlab代码

After several twists and turns, how long can the TSDB C-bit of influxdb last?
![[machine learning] support vector machine classification](/img/6d/e4fb9b5bf82362edcebbf366f9b73e.png)
[machine learning] support vector machine classification

3、 Uni app fixed or direct to a certain page

Application of time series database in cigarette factory

架构实战营第8模块作业
![[image hiding] digital image information hiding system based on DCT, DWT, LHA, LSB, including various attacks and performance parameters, with matlab code](/img/a4/5c5a90508e2f9c6b4f8e234bdfdc9e.png)
[image hiding] digital image information hiding system based on DCT, DWT, LHA, LSB, including various attacks and performance parameters, with matlab code
随机推荐
6-20漏洞利用-proftpd测试
C语言循环语句强化练习题
Method of win7 system anti ARP attack
DevCon.exe 导出output至指定文件
BLDC 6步换相 simulink
SRS4.0安装步骤
2022年最火的十大测试工具,你掌握了几个
Learn from Li Mu, deep learning - linear regression and basic optimization function
ECS 5 workflow
More loading in applets (i.e. list paging)
Pytorch:快速求得NxN矩阵的主对角线(diagonal)元素与非对角线元素
Application of time series database in bridge monitoring field
Structure and working principle of thyristor
【图像隐藏】基于DCT、DWT、LHA、LSB的数字图像信息隐藏系统含各类攻击和性能参数附matlab代码
[R language - basic drawing]
软件测试开发基础|测开中的几个工具开发实战
Random finite set RFs self-study notes (6): an example of calculation with the formula of prediction step and update step
Solve the critical path in FJSP - with Matlab source code
cv5200无线WiFi通信模块,视频图像传输无线化,实时无线通信技术
SQL custom automatic calculation