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

Overload of `StrReplaceAll()` to replace character sequences within a given output string _in place_ with replacements provided within an initializer list of key&sol;value pairs, returning the number of substitutions that occurred&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
StrReplaceAll(
    std::initializer&lowbar;list&lt;std::pair&lt;std::string&lowbar;view, std::string&lowbar;view&gt;&gt; replacements,
    std::string* target);
----

== Description

Example&colon;

std&colon;&colon;string s &equals; std&colon;&colon;string(&quot;stem:[who bought ]count &num;Noun&period; Thanks $who!&quot;)&semi; int count&semi; count &equals; absl&colon;&colon;StrReplaceAll(&lcub;&lcub;&quot;$count&quot;, absl&colon;&colon;StrCat(5)&rcub;, &lcub;&quot;$who&quot;, &quot;Bob&quot;&rcub;, &lcub;&quot;&num;Noun&quot;, &quot;Apples&quot;&rcub;&rcub;, &amp;s)&semi; EXPECT&lowbar;EQ(count, 4)&semi; EXPECT&lowbar;EQ(&quot;Bob bought 5 Apples&period; Thanks Bob!&quot;, s)&semi;

== Return Value

The number of substitutions that occurred&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *replacements*
| The 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]#
