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 :: lcm function c++ 
Cpp :: c++ mst kruskal 
Cpp :: what is the difference between i++ and ++ i ? 
Cpp :: how to make for loop in c++ 
Cpp :: create random vectors c++ 
Cpp :: c++ check if string is empty 
Cpp :: c++ map loop through key value 
Cpp :: opencv rgb to gray c++ 
Cpp :: elixir update map 
Cpp :: wine linux 
Cpp :: copy array c++ 
Cpp :: c++ reverse integer 
Cpp :: http.begin arduino not working 
Cpp :: c++ how to make a negative float positive 
Cpp :: string length c++ 
Cpp :: prime numbers less than a given number c++ 
Cpp :: number of lines in c++ files 
Cpp :: file open cpp 
Cpp :: C++ string initialization 
Cpp :: round up 2 digits float c++ 
Cpp :: cpp std list example 
Cpp :: convert string to lpwstr 
Cpp :: c++ check palindrome 
Cpp :: C++ structure (Struct) 
Cpp :: run cmd command c++ 
Cpp :: int max c++ 
Cpp :: continue statement in c++ program 
Cpp :: c++ fstream create if not exists 
Cpp :: memmove 
Cpp :: c++ struct 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =