MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / remove_suffix

Method remove_suffix

include/stringzilla/stringzilla.hpp:3019–3022  ·  view source on GitHub ↗

* @brief Removes the last `n` characters from the view. * @warning The behavior is @b undefined if `n > size()`. */

Source from the content-addressed store, hash-verified

3017 * @warning The behavior is @b undefined if `n > size()`.
3018 */
3019 void remove_suffix(size_type n) noexcept {
3020 assert(n <= size());
3021 sz_string_erase(&string_, size() - n, n);
3022 }
3023
3024 /** @brief Added for STL compatibility. */
3025 basic_string substr() const noexcept { return *this; }

Callers 3

test_searchFunction · 0.45
iteratorMethod · 0.45
iteratorClass · 0.45

Calls 1

sz_string_eraseFunction · 0.85

Tested by 1

test_searchFunction · 0.36