当前位置:网站首页>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);
}
边栏推荐
- [image segmentation] vein segmentation based on directional valley detection with matlab code
- 三类6种地图可视化软件测评,最好用的工具居然是它
- Photoshop web design practical tutorial
- Libgdx learning path 01: libgdx introduction and running tutorial
- It is the best tool to evaluate six kinds of map visualization software in three categories
- Parity rearrangement of Bm14 linked list
- Pytest custom hook function
- Regular expressions related to face-to-face orders of major express companies in JS
- uwb模块实现人员精确定位,超宽带脉冲技术方案,实时厘米级定位应用
- How many of the top ten test tools in 2022 do you master
猜你喜欢

Solve the critical path in FJSP - with Matlab source code

How many of the top ten test tools in 2022 do you master

Kotlin Android development novice tutorial

Srs4.0 installation steps

Efficiency comparison of JS array splicing push() concat() methods

SQL custom automatic calculation

RTC clock: a calendar

Accumulation and development -- the way of commercialization of open source companies

It is the best tool to evaluate six kinds of map visualization software in three categories
![[physical application] atmospheric absorption loss with matlab code](/img/72/e6ac23012a59ac48a37bcbb068890b.png)
[physical application] atmospheric absorption loss with matlab code
随机推荐
OAI L3 and L2 interface analysis
智能合约安全——溢出漏洞
R language text mining and natural language processing tutorial
ACM warm-up exercise 3 in 2022 summer vacation (detailed)
VIM learning manual
If you want to change to it, does it really matter if you don't have a major?
Pyg builds heterogeneous graph attention network han to realize DBLP node prediction
unity CS1513
顺序线性表——课上练
QT with line encoding output cout
Accumulation and development -- the way of commercialization of open source companies
[radar] radar signal online sorting based on kernel clustering with matlab code
Image processing web application development tutorial
Wechat official account custom sharing and updateappmessagesharedata are all successful. Why is it a link that is shared?
An intern's journey to cnosdb
【物理应用】水下浮动风力涡轮机的尾流诱导动态模拟风场附matlab代码
BM16 删除有序链表中重复的元素-II
BM11 链表相加(二)
C language (high-level) character function and string function + Exercise
DevCon.exe 导出output至指定文件