How to get ASCII value from String class?
Hi,
I have a string with text. I would like to iterate through the string and compare each character to an ASCII number. I cannot find a very clear answer....the only things I can think up requre multiple lines of code.
Code:
string text="Good morning";
for(int i = 0; i< text.length(); i++){
// here is where I need to code to extract a single character
// using substr and getting the ASCII value.
}
I would like to avoid using char arrays. Is there a nice ANSI C++ way of doing this?
Thanks,
ChuckB