@syntax_hacker0/

RemovingSubstringfromString

C++11

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string>
// using namespace std;
using namespace std;
using std::cout;
int main() {

std::string t = "Banana Republic";
std::string s = "Banana ";

std::string::size_type i = t.find(s);
cout<< i; 
if (i != std::string::npos)
   t.erase(i, s.length());
cout << t;
}