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
Android 短信广播接收相关问题
Silverlight5 Tools安装失败及解决方案
验证码刷新
Silverlight动态生成控件实例
spring 属性注入
asp.net XMLHttpRequest 进度条以及lengthComputable always false的解决办法
Spring.Net 初探之牛刀小试
iframe载入页面过程显示动画效果
一次让人晕到吐血的接包经历