[#util-RemovePrefix]
= xref:util.adoc[util]::RemovePrefix
:relfileprefix: ../
:mrdocs:

Return a copy of str with the given prefix removed, if present&period;

== Synopsis

Declared in `&lt;util&sol;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
std::string
RemovePrefix(
    std::string&lowbar;view str,
    std::string&lowbar;view prefix);
----

== Return Value

A new string without the leading prefix, or a copy of str&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *str*
| Input string&period;
| *prefix*
| Prefix to strip when str starts with it&period;
|===


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