Help get last two chars

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)...
substr:

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

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