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

Strips the `expected` prefix, if found, from the start of `str`&period; If the operation succeeded, `true` is returned&period; If not, `false` is returned and `str` is not modified&period;

== Synopsis

Declared in `&lt;absl&sol;strings&sol;strip&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
bool
ConsumePrefix(
    std::string&lowbar;view* str,
    std::string&lowbar;view expected);
----

== Description

Example&colon;

absl&colon;&colon;string&lowbar;view input(&quot;abc&quot;)&semi; EXPECT&lowbar;TRUE(absl&colon;&colon;ConsumePrefix(&amp;input, &quot;a&quot;))&semi; EXPECT&lowbar;EQ(input, &quot;bc&quot;)&semi;

== Return Value

`true` if the prefix was found and removed, `false` otherwise&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *str*
| The string to strip the prefix from in place&period;
| *expected*
| The prefix to remove&period;
|===


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