Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ remove last character from string

#include <iostream>
using namespace std;
int main()
{
    string s = "madara";
    s.substr(0, s.size() - 1); //madar
  
   //Another method: By resizing string
    s = "uchiha";
    s.resize(s.size()-1); //uchih
  
  return 0;
}
Source by www.codevscolor.com #
 
PREVIOUS NEXT
Tagged: #remove #character #string
ADD COMMENT
Topic
Name
5+6 =