public static string Chr(int asciiCode)
{
string strCharacter = "";
if (asciiCode >= 0 && asciiCode <= 255)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] byteArray = new byte[] { (byte)asciiCode };
strCharacter = asciiEncoding.GetString(byteArray); }
return strCharacter;
}这是我一个转换的方法,可是当asciiCode>140是,就会返回的?号的符号,什么原因?改如何修改?
{
string strCharacter = "";
if (asciiCode >= 0 && asciiCode <= 255)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] byteArray = new byte[] { (byte)asciiCode };
strCharacter = asciiEncoding.GetString(byteArray); }
return strCharacter;
}这是我一个转换的方法,可是当asciiCode>140是,就会返回的?号的符号,什么原因?改如何修改?
public static string Chr(int asciiCode)
{
return ((char)asciiCode).ToString();
}
chr(67) = 'C'
Chr(167) = '§'