C++ Erase vector element by value rather than by position?
How about std::remove() instead: This combination is also known as the erase-remove idiom.
How about std::remove() instead: This combination is also known as the erase-remove idiom.
Well, you could erase() the first character too (note that erase() modifies the string): But in this case, a simpler way is to take a substring: Be careful to validate that the string actually has at least two characters in it first…