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);
Simple solution if you are using C++11. Probably O(1) time as well:
st.pop_back();