关于分隔字符串问题
byte[] RByte = {0x02,0x30,0x31,0x04,0x02,0x32,0x33,0x04};
char[] a ={ '\u0002 ', '\u0004 '};
string[] Rstr =Encoding.ASCII.GetString(RByte).Split(a);
为什么Rstr.Length输出是5,不是2?
------解决方案--------------------string[] Rstr = Encoding.ASCII.GetString(RByte).Split(a, StringSplitOptions.RemoveEmptyEntries);
这样就是二了,RemoveEmptyEntries排除空值
//一眼就看出来的事情...-_-!!!
one
two
three
four
five
six
seven