c# - How to get hexadecimal number of a char? -
i have develop windows mobile c# app compare chars , ascii code
this pseudocode:
public void getascii(char c) { int ascii_n = c.getascii(); //or gives me hexadec number //you know; a=97, b=98... if (ascii_n > 12 && ascii_n < 23) { //code lines } else if (ascii_n > 24 && ascii_n < 55) { //more code lines } } any idea how can it??
you don't need hex representation of char, conversion integer enough
char c = '\n'; int ascii_n = (int)c; console.writeline(ascii_n); // = 10 also char higher 255
char c = '∙'; int = (int)c; console.writeline(a); // = 8729
Comments
Post a Comment