Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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
Comment

c++ string remove first character

string name = "My String";

// To remove First character
name.erase(name.begin());
// To remove Last character
name.pop_back();
std::cout << name << std::endl;
// Output : y Strin
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to complie with c++ 17 
Cpp :: fahrenheit to kelvin formula 
Cpp :: c++ hide cursor 
Cpp :: convert whole string to lowercase c++ 
Cpp :: how to print items in arduino 
Cpp :: std::string to qstring 
Cpp :: maximum in vector 
Cpp :: Count set bits in an integer c++ 
Cpp :: split vector in half cpp 
Cpp :: prime number generator c++ 
Cpp :: c++std vector three elemet c++ 
Cpp :: how to append one vector to another c++ 
Cpp :: sum vector c++ 
Cpp :: file descriptor linux c++ 
Cpp :: capture an entire line C++ 
Cpp :: resizing dynamic array c++ 
Cpp :: declare dictionary cpp 
Cpp :: c++ string to wstring 
Cpp :: how to speed up cin and cout 
Cpp :: border radius layout android xml 
Cpp :: c++ remove whitespace from string 
Cpp :: c++ string to double 
Cpp :: input a string in c++ 
Cpp :: prime number in c++ 
Cpp :: minimum and maximum value of a vector in C++ 
Cpp :: string to integer convert c++ 
Cpp :: c++ lcm 
Cpp :: find in set of pairs using first value cpp 
Cpp :: c++ program to take input from user 
Cpp :: c++ case 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =