Deleting Part of the Value of a String: erase()

Removing characters from a string can be done using erase(). This member function takes two parameters, the starting position and the number of characters to remove. 
Syntax: source.erase(start_pos, numchars);

The erase() function removes the characters and closes up the string. If the second parameter is omitted, the function erases characters from the starting position to the end of the string.
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment: