如#00,1,1#00,2,2#00,3,3#如何转换成数组?
换成数组:
00 1 1
00 2 2
00 3 3
[解决办法]
string str = "#00,1,1#00,2,2#00,3,3#";string[] ar = str.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);string[][] ar1=new string[ar.Length][];for (int i = 0; i < ar.Length; i++){ if (!string.IsNullOrEmpty(ar[i])) { ar1[i] = ar[i].Split(','); }}
[解决办法]
如果#00,1,1#00,2,2#00,3,3#是字符串,那么先用replace将逗号替换为空格,然后用split按#号分组
[解决办法]
活用string.splite,经常会碰到的
[解决办法]
恩,splite