Letters to Numbers with C++ chars -


say have char extracted string ( str.at(i) ), how convert char number such a=0, b=1, c=2... z=25? thanx in advance

assuming string in a-z range, char_value - 'a'.

this assumes letters consecutive. 'b' == 'a' + 1, 'c' == 'a' + 2, etc. in ascii, assumption correct.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -