c#|Unity怎么按16进制发送udp命令

  private byte[] textWork16(string strText)
    {
        strText = strText.Replace(" ", "");
        byte[] bText = new byte[strText.Length / 2];
        for (int i = 0; i < strText.Length / 2; i++)
        {
            bText[i] = Convert.ToByte(Convert.ToInt32(strText.Substring(i * 2, 2), 16));
        }
        return bText;
    }
感谢郑州IoT王猛大佬

猜你喜欢

转载自blog.csdn.net/qq_36848370/article/details/80064880