Home > Net > How to turn a string of hexadecimal ASCII array form
How to turn a string of hexadecimal ASCII array form
Time:10-08
Such as string buf="124" + "" +" 245 "+" "+" 789 ";//"" said the blank space in the middle of the //need to convert hexadecimal ASCII form, put into a byte array, good to send out a serial port communication,
Byte [] buf16=the string converted to hexadecimal array form;
CodePudding user response:
Byte [] buf16=Encoding. The ASCII. GetBytes (buf);
CodePudding user response:
buf. Split (' '). The Select (s=& gt; The Convert. ToByte (s)). ToArray ()