[#util-HasPrefix] = xref:util.adoc[util]::HasPrefix :relfileprefix: ../ :mrdocs: Check whether a container begins with the given prefix. == Synopsis Declared in `<util/string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T1, size_t PREFIX_LEN> [[nodiscard]] bool HasPrefix( T1 const& obj, std::array<uint8_t, PREFIX_LEN> const& prefix); ---- == Return Value true if obj is at least PREFIX_LEN long and starts with prefix. [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. | *prefix* | The prefix bytes to compare against the start of obj. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#