how can remove all the character of string except last c++ code example
Example 1: remove last character from string c++
st = myString.substr(0, myString.size()-1);
Example 2: remove or erase first and last character of string c++
str.pop_back(); // removes last /back character from str
str.erase(str.begin()); // removes first/front character from str