[#bsl-basic_string-0faf-insert-030]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf/iterator.adoc[iterator]
xref:bsl/basic_string-0faf/insert-08.adoc[insert](
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] position,
    CHAR&lowbar;TYPE character);
----

[.small]#xref:bsl/basic_string-0faf/insert-08.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf/iterator.adoc[iterator]
xref:bsl/basic_string-0faf/insert-060.adoc[insert](
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] position,
    std::initializer&lowbar;list&lt;CHAR&lowbar;TYPE&gt; values);
----

[.small]#xref:bsl/basic_string-0faf/insert-060.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-047.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string] const& other);
----

[.small]#xref:bsl/basic_string-0faf/insert-047.adoc[_» more&period;&period;&period;_]#

Insert a null&hyphen;terminated character string at the given position&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-0a.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    CHAR&lowbar;TYPE const* characterString);
----

[.small]#xref:bsl/basic_string-0faf/insert-0a.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE&gt;
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-03a.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& other);
----

[.small]#xref:bsl/basic_string-0faf/insert-03a.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf/iterator.adoc[iterator]
xref:bsl/basic_string-0faf/insert-043.adoc[insert](
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] position,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars,
    CHAR&lowbar;TYPE character);
----

[.small]#xref:bsl/basic_string-0faf/insert-043.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-0c.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars,
    CHAR&lowbar;TYPE character);
----

[.small]#xref:bsl/basic_string-0faf/insert-0c.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-095.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    CHAR&lowbar;TYPE const* characterString,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars);
----

[.small]#xref:bsl/basic_string-0faf/insert-095.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITER&gt;
xref:bsl/basic_string-0faf/iterator.adoc[iterator]
xref:bsl/basic_string-0faf/insert-094.adoc[insert](
    xref:bsl/basic_string-0faf/const_iterator.adoc[const&lowbar;iterator] position,
    INPUT&lowbar;ITER first,
    INPUT&lowbar;ITER last);
----

[.small]#xref:bsl/basic_string-0faf/insert-094.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-06b.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string] const& other,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] sourcePosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars = npos);
----

[.small]#xref:bsl/basic_string-0faf/insert-06b.adoc[_» more&period;&period;&period;_]#

Insert characters into this string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE&gt;
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
xref:bsl/basic_string-0faf/insert-07.adoc[insert](
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] position,
    STRING&lowbar;VIEW&lowbar;LIKE&lowbar;TYPE const& other,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] sourcePosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] numChars = npos);
----

[.small]#xref:bsl/basic_string-0faf/insert-07.adoc[_» more&period;&period;&period;_]#

== Return Value

* iterator referring to the first inserted character
* reference providing modifiable access to this string

== Parameters

[cols="1,4"]
|===
| Name| Description
| *position*
| starting index
| *character*
| character value
| *values*
| initializer list of characters
| *other*
| string or character sequence to compare or use
| *characterString*
| null&hyphen;terminated string to insert
| *numChars*
| number of characters
| *first*
| beginning of the range (inclusive)
| *last*
| end of the range (exclusive)
| *sourcePosition*
| starting index in the source string
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
