public static int Asc(string character)
{
if (character.Length == 1)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
int intAsciiCode = (int)asciiEncoding.GetBytes(character)[0];
return (intAsciiCode);
}
else
{
throw new Exception("Character is not valid.");
}
}
ASCII码转字符:
public static string Chr(int asciiCode)
{
if (asciiCode >= 0 && asciiCode <= 255)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] byteArray = new byte[] { (byte)asciiCode };
string strCharacter = asciiEncoding.GetString(byteArray);
return (strCharacter);
}
else
{
throw new Exception("ASCII Code is not valid.");
}
}
0
0
Fedora Redhat Centos 有什么区别和关系?
【KiCad】 如何给元件给元件的管脚加上划线?
MCU ADC 进入 PD 模式后出现错误的值?
FastAdmin 生产环境升级注意
EMC EMI 自行评估记录
如何让你的 KiCad 在缩放时不眩晕?
KiCad 5.1.0 正式版终于发布
一次单片机 SFR 页引发的“事故”
java基础之集合