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);
If the length is non zero, you can also
str[str.length() - 1] = '\0';