当前位置:网站首页>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);
}
边栏推荐
- 一家芯片公司倒在了B轮
- 【物理应用】大气吸收损耗附matlab代码
- 4、 Interface requests data to update input information interactively
- 【雷达】基于核聚类实现雷达信号在线分选附matlab代码
- Tikz draw Gantt chart in FJSP -trans necessary
- C语言循环语句强化练习题
- 架构实战营第8模块作业
- After several twists and turns, how long can the TSDB C-bit of influxdb last?
- Understanding of PID
- Structure and working principle of thyristor
猜你喜欢

Qt: 一个SIGNAL绑定多个SLOT

Powerbi time series analysis, prediction and visualization tutorial

OAI L3 and L2 interface analysis

How to obtain data on mobile phones and web pages after the SCM data is uploaded to Alibaba cloud Internet of things platform?

3、 Uni app fixed or direct to a certain page

Adobe Flash player 34.0.0.92 and available version modification methods (2021-01-23

GPIO port configuration of K60

Solve the critical path in FJSP - with Matlab source code

SQL审核工具自荐Owls

一家芯片公司倒在了B轮
随机推荐
Server body 21: pre compilation processing by different compilers (a brief introduction to MSVC and GCC)
[physical application] Wake induced dynamic simulation of underwater floating wind turbine wind field with matlab code
Application of time series database in museum environment detection
DevCon. Exe export output to the specified file
RFs self study notes (4): actual measurement model - the mixture of OK and CK, and then calculate the likelihood probability
Minio distributed file system learning notes
DevCon.exe 导出output至指定文件
BM11 链表相加(二)
使用百度EasyDL实现明厨亮灶厨师帽识别
Time waits for no man. The rise of TSDB is at the right time
Learn from Li Mu in depth -softmax return
Bm11 list addition (II)
QT running image
Streamlit machine learning application development tutorial
FTM module of K60: configure motor, encoder and steering gear
Using CPLEX to solve small-scale energy-efficient FJSP
Qt: 一个SIGNAL绑定多个SLOT
Wechat official account custom sharing and updateappmessagesharedata are all successful. Why is it a link that is shared?
Youqilin system installation beyondcomare
Web 3.0 development learning path