Skip to main content

sanitize

Function sanitize 

Source
pub fn sanitize(s: &str, max_bytes: usize) -> String
Expand description

Makes arbitrary text safe to send as msg or title: every control character (including newline and tab) becomes a space, and text longer than max_bytes is cut at a character boundary and ends with ….

Use limits::MAX_MSG_DECODED or limits::MAX_TITLE_DECODED as max_bytes.