for (int i = 0; i < strD.Length; i += 2)
{
strB= "0x" + strD.Substring(i, 2).ToString(); //每两个截取出来然后保存,strB=0x120x340x560x780x90
}
string[] hex = System.Text.RegularExpressions.Regex.Split(strB, "0x");
int a = 0;
for (int i = 1; i < hex.Length; i++)
a += Convert.ToInt32(hex[i], 10);
取出的话,你可以
String strB="0x120x340x560x780x90";
String[] hex = System.Text.RegularExpressions.Regex.Split(strB, "0x");
int a = 0;
for (int x = 1; x < hex.Length; x++)
a += Convert.ToInt32(hex[x], 16);