ASCII十进制转字符串的方法

        /// <summary>
/// ASCII转字符串
/// </summary>
/// <param name="asciiCode">ASCII对应十进制码</param>
/// <returns></returns>
public static string ASCIIToStr(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.");
}
}

  

上一篇:Lua中实现队列(高效方式)


下一篇:linux下的framebuffer显示图片