How to get ASCII value of string in C#
How to get ASCII value of string in C#
回答1
From MSDN
string value = "9quali52ty3";
// Convert the string into a byte[].
byte[] asciiBytes = Encoding.ASCII.GetBytes(value);
You now have an array of the ASCII value of the bytes. I got the following:
57 113 117 97 108 105 53 50 116 121 51
回答2
string s = "9quali52ty3";
foreach(char c in s)
{
Console.WriteLine((int)c);
}