User Tools

Site Tools


c_-_c_strings:erase_characters_from_a_string

This is an old revision of the document!


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.1508148654.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki