如果是单个字符:
int ascii = (int) 'a';如果是字符串:
byte[] ascii = System.Text.Encoding.ASCII.GetBytes("abcde");
这样的话,得到的数组与字符串中的字符一一对应,如果字符超过127,得到的是63,即"?"号。
int ascii = (int) 'a';如果是字符串:
byte[] ascii = System.Text.Encoding.ASCII.GetBytes("abcde");
这样的话,得到的数组与字符串中的字符一一对应,如果字符超过127,得到的是63,即"?"号。
String str = "aaa";
int[] ascii = new int[str.Length];
for (int i = 0; i < str.Length; i++) {
ascii[i] = (int) str[i];
}