Replace a substring of this string.

Synopsis

Declared in <bslstl_string.h>

basic_string&
replace(
    size_type outPosition,
    size_type outNumChars,
    CHAR_TYPE const* characterString);

Description

Replace the specified outNumChars characters starting at the specified outPosition in this string (or the suffix of this string starting at outPosition if outPosition + outNumChars > length()) with the specified null‐terminated characterString (of length CHAR_TRAITS::length(characterString)). Return a reference providing modifiable access to this string. Throw out_of_range if `outPosition > length()`.

Return Value

reference providing modifiable access to this string

Parameters

Name

Description

outPosition

index at which replacement begins

outNumChars

number of characters to replace

characterString

pointer to characters

Created with MrDocs