diff --git a/tstl/include/string.hpp b/tstl/include/string.hpp index 9242da4a..d7ab8753 100644 --- a/tstl/include/string.hpp +++ b/tstl/include/string.hpp @@ -305,6 +305,20 @@ public: (*this)[size()] = '\0'; } + /*! + * \brief Erase the character at the given position + */ + void erase(size_t position) { + if(position >= size()){ + return; + } + + std::copy(begin() + position + 1, end(), begin() + position); + + set_size(size() - 1); + (*this)[size()] = '\0'; + } + /*! * \brief Ensures a capacity of at least new_capacity */