0
Delete from string
How can I remove something from a string? Example: “tree” “tee”
2 Réponses
+ 3
If you have the option to work with C++ strings, calling the erase() method would be sufficient, the class will handle the rest for you:
https://en.cppreference.com/w/cpp/string/basic_string/erase
The class also provides various methods for finding certain characters in a string, e.g. find(), which return the index of the character, which you can then use as an argument for erase(). You can find all the necessary documentation with examples here:
https://en.cppreference.com/w/cpp/string/basic_string