Tutorial :best way of converting letters to base-10



Question:

So far I have something such as:

if( Char.IsDigit( c ) )      return Int32.Parse( "" + c );    if( Char.IsLetter( c ) )      return Char.ToUpper( c ) - 'A' + 1;  


Solution:1

For the first one:

if (Char.IsDigit(c))      return c - '0';  


Solution:2

There is a fairly detailed MSDN article which is just what you're looking for.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »