escape_c_str

Function escape_c_str 

Source
pub fn escape_c_str(s: &str) -> Result<String>
Expand description

Escapes a string according to C-style rules.

This function handles common escape sequences like \n, \t, ", \, etc. For other ASCII control characters or non-printable characters, it uses octal notation (e.g., \0, \177).

§Arguments

  • s: The string slice to be escaped.

§Returns

A Result<String> containing the new escaped string.