(1)
string empCode="";//一个ASCII码
string hex = empCode.Substring(0,2);
int value = Convert.ToInt32(hex, 16);
// string stringValue = Char.ConvertFromUtf32(value);
char charValue = (char)value;
empCode = empCode.Substring(2, empCode.Length - 2);
MatchCollection matchs = new Regex(@"3(\d)", RegexOptions.Singleline).Matches(empCode);
if (matchs.Count != 0)
{
foreach (Match match in matchs)
{
resultValue += match.Groups[1].Value;
}
}
empCode = charValue + resultValue;
补充一下:jsonstr是16进制的数据,
for (int i = 0; i < jsonStr.Length / 2; i++)
{
string hex = jsonStr.Substring(2*i, 2);
int value = Convert.ToInt32(hex, 16);
char charValue = (char)value;
//c[i] = charValue;
empCode += charValue;
}