| 761 | } |
| 762 | |
| 763 | void String::erase(size_t pos, size_t n) { |
| 764 | String ns; |
| 765 | ns.reserve(m_string.size() - std::min(n, m_string.size())); |
| 766 | auto it = begin(); |
| 767 | for (size_t i = 0; i < pos; ++i) |
| 768 | ns.append(*it++); |
| 769 | for (size_t i = 0; i < n; ++i) { |
| 770 | if (it == end()) |
| 771 | break; |
| 772 | ++it; |
| 773 | } |
| 774 | while (it != end()) |
| 775 | ns.append(*it++); |
| 776 | *this = ns; |
| 777 | } |
| 778 | |
| 779 | String String::padLeft(size_t size, String const& filler) const { |
| 780 | if (!filler.length()) |