日期:2014-05-17 浏览次数:20781 次
MatchCollection 集合 = Regex.Matches("17016112233445566","正则表达式");
List<byte> 缓存 = new List<byte>
foreach (Match 字节 in 集合)
{
缓存.Add(byte.Parse(m.Value, NumberStyles.HexNumber))
}
List<string> 缓存 = Regex.Split("17016112233445566","(?<=\\G\\d{2})").ToList();
string str = "17016112233445566";
List<string> List = new List<string>();
List.Add(str.Substring(0, 3));
var newList = System.Text.RegularExpressions.Regex.Split(str.Substring(3), "(?<=\\G.{2})(?!$)");
List.AddRange(newList.ToList());
List<string> resultList = new List<string>();
foreach (var s in List)
{
int num = Convert.ToInt32(s);
resultList.Add(Convert.ToString(num, 16));
}