How can I remove last character from a C++ string?
I tried st = substr(st.length()-1); But it didn\'t work.
st = substr(st.length()-1);
str.erase(str.begin() + str.size() - 1)
str.erase(str.rbegin()) does not compile unfortunately, since reverse_iterator cannot be converted to a normal_iterator.
str.erase(str.rbegin())
reverse_iterator
C++11 is your friend in this case.