C#将十六进制值转换为字符串值示例
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication15
{
class Program
{
static void Main(string[] args)
{
string hexavalues = "4F 6E 69 74 72 6F 61 64 21";
string[] strsplit = hexavalues.Split(' ');
foreach (String hexa in strsplit)
{
int values = Convert.ToInt32(hexa, 16);
string strvalue = Char.ConvertFromUtf32(values);
char character = (char)values;
Console.WriteLine("hexadecimal value = {0}, int value = {1}, char value = {2} or {3}",
hexa, values, strvalue, character);
}
Console.ReadLine();
}
}
}
在本文中,我们正在讨论如何将十六进制值转换为字符串值。
首先要执行此操作,我们将使用字符串类的拆分方法,并将单个十六进制值存储在字符串类型数组中,以便每个值对应于字符串,然后使用toint32()方法将十六进制值转换为十进制值。
日期:2020-04-11 22:50:33 来源:oir作者:oir
