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

Method resize

include/stringzilla/stringzilla.hpp:3594–3597  ·  view source on GitHub ↗

* @brief Resizes the string to match @p count, filling the new space with the given @p character. * @throw `std::length_error` if the string is too long. * @throw `std::bad_alloc` if the allocation fails. */

Source from the content-addressed store, hash-verified

3592 * @throw `std::bad_alloc` if the allocation fails.
3593 */
3594 void resize(size_type count, value_type character = '\0') noexcept(false) {
3595 if (count > max_size()) throw std::length_error("sz::basic_string::resize");
3596 if (!try_resize(count, character)) throw std::bad_alloc();
3597 }
3598
3599 /**
3600 * @brief Resizes the string to a specified number of characters without initializing new elements.

Callers 15

computeMethod · 0.80
replace_all_with_finderFunction · 0.80
test_utf8_ci_find_fuzzFunction · 0.80
test_memory_utilitiesFunction · 0.80
test_replacementsFunction · 0.80
randomize_stringsFunction · 0.80
tokenizeFunction · 0.80
build_environmentFunction · 0.80

Calls

no outgoing calls

Tested by 8

test_utf8_ci_find_fuzzFunction · 0.64
test_memory_utilitiesFunction · 0.64
test_replacementsFunction · 0.64
randomize_stringsFunction · 0.64