Converts the hexadecimal encoded data in hex into raw bytes in the bytes output string. If hex does not consist of valid hexadecimal data, this function returns false and leaves bytes in an unspecified state. Returns true on success.
Declared in <absl/strings/escaping.h>
[[nodiscard]]
bool
HexStringToBytes(
std::string_view hex,
std::string* bytes);
true on success, false if hex is not valid hexadecimal data.
The return value should not be discarded.
| Name | Description |
|---|---|
| hex | The hexadecimal-encoded string to decode. |
| bytes | The output string that receives the decoded bytes. |