日期:2014-05-17 浏览次数:20885 次
string str = "11DX-3L-3JY-4J-5Q";
string[] arry = str.Split('-');
string[,] aa = new string[arry.Length, 2];
for (int i = 0; i < arry.Length; i++)
{
int k = 0;
for (int j = 0; j < arry[i].Length; j++)
{
if (arry[i][j] > '9'
------解决方案--------------------
arry[i][j] < '0')
break;
k++;
}
aa[i, 0] = arry[i].Substring(0, k);
aa[i, 1] = arry[i].Substring(k);
}
string strsource = "11DX-3L-3JY-4J-5Q";
var arr=strsource.Split('-');
string[,] result = new string[arr.Count(), 2];
for (int k=0;k< arr.Length;k++)
{
result[k, 0] = Regex.Split(arr[k], "(?is)(?<=\\d)(?=[a-z])")[0];
result[k, 1] = Regex.Split(arr[k], "(?is)(?<=\\d)(?=[a-z])")[1];