Escapes a src string using C-style escape sequences, escaping other non-printable/non-whitespace bytes as hexadecimal sequences (e.g. "xFF").
Declared in <absl/strings/escaping.h>
std::string
CHexEscape(std::string_view src);
Example:
std::string s = "foorbartbaz010011012013014x0dn"; std::string escaped_s = absl::CHexEscape(s); EXPECT_EQ(escaped_s, "foo\rbar\tbaz\x08\t\n\x0b\x0c\r\n");
The escaped string.
| Name | Description |
|---|---|
| src | The string to escape. |