mod control;
mod line_endings;
mod whitespace;
#[cfg(test)]
mod tests;
pub use control::remove_control_chars;
pub use line_endings::normalize_line_endings;
pub use whitespace::{normalize_whitespace, trim_lines};
use alloc::string::String;
fn collapse_consecutive_spaces(text: &str) -> String {
let mut result = String::with_capacity(text.len());
let mut prev_was_space = false;
for c in text.chars() {
if c == ' ' {
if !prev_was_space {
result.push(c);
prev_was_space = true;
}
} else {
result.push(c);
prev_was_space = false;
}
}
result
}