我想将下面这个字符串数组中转码并提取有用的信息
136,19,0,128,1,4,86,72,56,81,95,51,49,51,57,56,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,229,164,143,230,154,174,228,186,145,0,0,0,0,0,0,0,0,0,6,0,48,51,46,112,110,103,1,11,1,229,136,157,229,173,166,228,185,141,231,187,131,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,0,2,0,54,0,
string ret = "";
string txt = “136,19,0,128,1,4,86,72,56,81,95,51,49,51,57,56,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,229,164,143,230,154,174,228,186,145,0,0,0,0,0,0,0,0,0,6,0,48,51,46,112,110,103,1,11,1,229,136,157,229,173,166,228,185,141,231,187,131,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,0,2,0,54,0,”;
string txtmessage = txt.Remove(txt.LastIndexOf(","), 1);
string[] array = txtmessage.Split(',');
for (int i = 0; i < array.Length; i++)
{
ret += "%" + int.Parse(array[i]).ToString("x");
}
结果是�%0�%1%4VH8Q_313987%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0夏暮云%0%0%0%0%0%0%0%0%0%6%003.png%1%b%1初学乍练%0%0%0%0%0%0%0%01%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%1%1%2%0%2%06%0
我想要的是其中不是0的数据,并且是不需要转码的 ,原来字符串数组中的数组,但汉字和VH8Q_313987和03.png这两个个字符串是需要转码过的,哪位大大有办法,这个字符串只是部分,最好是个通用的方法。谢谢
|