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

Assign to this string the value of the specified `replacement` string, propagate to this object the allocator of `replacement` if the `ALLOCATOR` type has trait `propagate&lowbar;on&lowbar;container&lowbar;move&lowbar;assignment`, and return a reference providing modifiable access to this string&period; The content of `replacement` is moved (in constant time) to this string if `get&lowbar;allocator() &equals;&equals; rhs&period;get&lowbar;allocator()` (after accounting for the aforementioned trait)&period; `replacement` is left in a valid but unspecified state&period; Note that this method has exactly the same behavior as the corresponding `operator&equals;`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]&
assign(xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;basic&lowbar;string&gt;] replacement) noexcept(false);
----


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