normalize_whitespace

Function normalize_whitespace 

Source
pub fn normalize_whitespace(text: &str) -> String
Expand description

Normalize whitespace by collapsing consecutive spaces and tabs.

Multiple spaces and tabs are replaced with a single space. Newlines are preserved. Unicode spaces are normalized to ASCII spaces.

§Arguments

  • text - The text to normalize

§Returns

Normalized text with collapsed spaces/tabs but preserved newlines