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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top