Character.digit(char ch, int radix)
Returns the numeric value of the character ch in the specified radix.
Is there an equivalent function in c#?
I don't know of a direct equivalent
The closest match I can find is
Convert.ToInt32(string s, int baseFrom);
So you could convert your char to string then pass it in to the above function to get the int32 or Int16 or Byte or however you want to handle it :
char c = 'F';
int digit = Convert.ToInt32(c.ToString(),16);
Note - Convert will throw a FormatException if the char isn't a digit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With