Function ics::escape_text [−][src]
pub fn escape_text<'a, S>(input: S) -> Cow<'a, str> where
S: Into<Cow<'a, str>>,
Expand description
Escapes comma, semicolon, backslash and newline character by prepending a backslash. Newlines are normalized to a line feed character.
This method is only necessary for properties with the value type “TEXT”.
Example
use ics::escape_text; let line = "Hello, World! Today is a beautiful day to test: Escape Methods.\n Characters like ; or \\ must be escaped."; let expected = "Hello\\, World! Today is a beautiful day to test: Escape Methods.\\n Characters like \\; or \\\\ must be escaped."; assert_eq!(expected, escape_text(line));