Help get last two chars

Sep 6, 2011 at 4:33pm
So how to get last two characters of a string, Let a user type his desired text that will be stored in a string and how to get last two characters of string and put condition according to characters,

like if(lasttwochars == aa)...
Sep 6, 2011 at 5:57pm
substr:

http://cplusplus.com/reference/string/string/substr/

 
if(mystring.substr( mystring.length() - 2 ) == "aa")
Topic archived. No new replies allowed.