std::basic_string::resize

From Cppreference

Jump to: navigation, search
void resize( size_type count );
(1)
void resize( size_type count, CharT ch );
(2)

Resizes the string to contain count characters.

If the current size is less than count, additional characters are appended.

If the current size is greater than count, the string is reduced to its first count elements.

The first version initializes new characters to CharT(), the second version initializes new characters to ch.

Contents

[edit] Parameters

count - new size of the string
ch - character to initialize the new characters with

[edit] Return value

(none)

[edit] Complexity

linear in the size of the string

[edit] See also

size
returns the number of characters
(public member function)