[#absl-StrReplaceAll-04]
= xref:absl.adoc[absl]::StrReplaceAll
:relfileprefix: ../
:mrdocs:

Overload of `StrReplaceAll()` to replace patterns within a given output string _in place_ with replacements provided within a container of key&sol;value pairs&period;

== Synopsis

Declared in `&lt;absl&sol;strings&sol;str&lowbar;replace&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename StrToStrMapping&gt;
int
StrReplaceAll(
    StrToStrMapping const& replacements,
    std::string* target);
----

== Description

Example&colon;

std&colon;&colon;string s &equals; std&colon;&colon;string(&quot;if (ptr &lt; &amp;foo)&quot;)&semi; int count &equals; absl&colon;&colon;StrReplaceAll(&lcub;&lcub;&quot;&amp;&quot;, &quot;&amp;amp&semi;&quot;&rcub;, &lcub;&quot;&lt;&quot;, &quot;&amp;lt&semi;&quot;&rcub;, &lcub;&quot;&gt;&quot;, &quot;&amp;gt&semi;&quot;&rcub;&rcub;, &amp;s)&semi; EXPECT&lowbar;EQ(count, 2)&semi; EXPECT&lowbar;EQ(&quot;if (ptr &amp;lt&semi; &amp;amp&semi;foo)&quot;, s)&semi;

== Return Value

The number of substitutions that occurred&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *replacements*
| The container of key&sol;value pairs of sequences to replace&period;
| *target*
| The string to modify in place&period;
|===


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