ascii

  • Thread starter Thread starter ally
  • Start date Start date
ally said:
How can I convert a string to a ascii code in c#?

Do you mean a single character within a string? Just get the character,
e.g.

string h = "hello";
char c = h[3];

Now the character is the Unicode value, but all ASCII values are the
same in Unicode. So, for instance:

int i = c;

will make i be the ASCII code for 'l'.

(Converting to int isn't really necessary, but perhaps makes it
clearer.)
 
Back
Top