Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to remove a index from a string in cpp

// CPP code to illustrate
// erase(size_type idx, size_type len )
#include <iostream>
#include <string>
using namespace std;
 
// Function to demo erase
void eraseDemo(string str)
{
    // Deletes 4 characters from index number 1
    str.erase(1, 4);
 
    cout << "After erase : ";
    cout << str;
}
 
// Driver code
int main()
{
    string str("Hello World!");
 
    cout << "Before erase : ";
    cout << str << endl;
    eraseDemo(str);
 
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: find prime number c++ 
Cpp :: cpp string slice 
Cpp :: how to input a vector when size is unknown 
Cpp :: convert letters to uppercase in c++ 
Cpp :: int to float c++ 
Cpp :: find the missing number 
Cpp :: How to write into files in C++ 
Cpp :: modulo subtraction 
Cpp :: insert a character into a string c++ 
Cpp :: c++ insert into map 
Cpp :: c++ get line 
Cpp :: getline(cin string) not working 
Cpp :: check prime cpp gfg 
Cpp :: remove element from vector 
Cpp :: C++ float and double Different Precisions For Different Variables 
Cpp :: Search Insert Position leetcode solution in cpp 
Cpp :: pure virtual function in c++ 
Cpp :: position of max element in vector c++ 
Cpp :: quicksort 
Cpp :: c++ find object in vector by attribute 
Cpp :: std::count() in C++ STL 
Cpp :: check even or odd c++ 
Cpp :: access last element of set c++ 
Cpp :: heap buffer overflow in c 
Cpp :: exponent of x using c c++ 
Cpp :: vector from angle 
Cpp :: prevent copy c++ 
Cpp :: program to swap max and min in matrix 
Cpp :: find the graph is minimal spanig tree or not 
Cpp :: c++ add input in 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =