Escapes a src string using C‐style escape sequences, escaping other non‐printable/non‐whitespace bytes as hexadecimal sequences (e.g. "xFF").

Synopsis

Declared in <absl/strings/escaping.h>

std::string
CHexEscape(std::string_view src);

Description

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");

Return Value

The escaped string.

Parameters

Name

Description

src

The string to escape.

Created with MrDocs