Convert character to its alphabet integer position?
The above line asks a question as to how you get the index numeric value of a letters position in the alphabet. The accepted answer is:
char c = 'A';
//char c = 'b'; you may use lower case character.
int index = char.ToUpper(c) - 64;//index == 1
Can someone please explain the theory of this to me? Why and how does this work?