Parse the hex string into bytes (uint8_t or std::byte). Ignores whitespace. Returns nullopt on invalid input.

Synopsis

Declared in <util/strencodings.h>

template<typename Byte = std::byte>
std::optional<std::vector<Byte>>
TryParseHex(std::string_view str);

Return Value

The decoded bytes, or std::nullopt if the input is not valid hex.

Parameters

Name

Description

str

The hex string to parse.

Created with MrDocs