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

Check whether a container begins with the given prefix&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename T1,
    size&lowbar;t PREFIX&lowbar;LEN&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
HasPrefix(
    T1 const& obj,
    std::array&lt;uint8&lowbar;t, PREFIX&lowbar;LEN&gt; const& prefix);
----

== Return Value

true if obj is at least PREFIX&lowbar;LEN long and starts with prefix&period;

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

[cols="1,4"]
|===
| Name| Description
| *obj*
| The byte container to inspect&period;
| *prefix*
| The prefix bytes to compare against the start of obj&period;
|===


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