Insert characters into this string.
Declared in <bslstl_string.h>
template<class STRING_VIEW_LIKE_TYPE>
basic_string&
insert(
size_type position,
STRING_VIEW_LIKE_TYPE const& other,
size_type sourcePosition,
size_type numChars = npos);
Insert at the specified position in this string the optionally specified numChars characters starting at the specified sourcePosition in the bsl::string_view object, obtained from the specified other, or the suffix of this object starting at sourcePosition if sourcePosition + numChars > other.length(). If numChars is not specified, npos is used. Return a reference providing modifiable access to this string. Throw out_of_range if position > length() or sourcePosition > other.length(). Throw length_error if the length of the resulting string exceeds max_size().
reference providing modifiable access to this string
| Name | Description |
|---|---|
| numChars | number of characters |
| position | starting index |
| other | string or character sequence to compare or use |
| sourcePosition | starting index in the source string |