User Tools

Site Tools


c_-_c_strings:erase_characters_from_a_string

C - C++ Strings - Erase characters from a string

#include <iostream>
#include <string>
using namespace std;
 
int main()
{
  string str1("String handling C++ style.");
  string str2("STL Power");
 
  cout << "Initial strings:\n";
  cout << "str1: " << str1 << endl;
  cout << "str2: " << str2 << "\n\n";
 
  // Erase some characters.
  cout << "Remove 9 characters from str1:\n";
  str1.erase(6, 9);
  cout << str1 <<"\n\n";
 
  return 0;
}
c_-_c_strings/erase_characters_from_a_string.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki