std::string mystring; char last_char; last_char = mystring[mystring.length() - 1];You can make function that does it:
inline char getlastchar(std::string &s) { if (s.length() == 0) return '\0'; return s[s.length() - 1]; }
std::string mystring; char last_char; last_char = mystring[mystring.length() - 1];You can make function that does it:
inline char getlastchar(std::string &s) { if (s.length() == 0) return '\0'; return s[s.length() - 1]; }