Skip to content

Rose::StringUtility::cUnescape

Unescapes C++ string literals.

Synopsis

Declared in <src/Rose/StringUtility/Escape.h>

[[visibility]]
std::string
cUnescape(std::string const&);

Description

When given a C++ string literals content, the part between the enclosing quotes, this function will look for escape sequences, parse them, and replace them in the return value with the actual characters they represent. For instance, passing in std::string{"hello\\nworld\\00hidden"} that contains 20 characters including two backslashes, the function replaces the first backslash+"n" pair with a line feed, and the second backslash+"0"+"0" with a NUL to result in std::string{"hello\nworld\0hidden"} (18 characters including the LF and NUL). Unicode escapes are not supported and will be left escaped in the return value.

Return Value

Unescaped string.

Created with MrDocs