//字符串转换为字符串数组
string str= "A B C D E F";
//可根据字符串特点,用SPlit方法进行分割
string[] attr= str.Split(' '); //attr={"A","B","C","D","E","F"}
//字符串转换为字节数组
string Msg = "你好123";
byte[] msg = Encoding.Default.GetBytes(Msg);
//字符串数组转换为字节数组
private byte[] byteTostring(string[] strdata)
{
int count = strdata.Length;
byte[] bt = new byte[count];
int j = 0;
foreach (string str in strdata)
{
bt[j] = (byte)Convert.ToInt32(str, 16);
j++;
while (j >= count)
{
break;
}
}
版权声明:本文为qq_22889875原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。