chomp

Function chomp 

Source
pub fn chomp(text: &str) -> (&str, &str, &str)
Expand description

Extract boundary whitespace from text (chomp).

Returns (prefix, suffix, trimmed_text) tuple. Prefix/suffix are “ “ if original text had leading/trailing whitespace. However, suffix is “” if the trailing whitespace is only newlines (not spaces/tabs). This prevents trailing newlines from becoming trailing spaces in the output. The trimmed text has all leading/trailing whitespace removed.