#trim #string #white-space #single #tail #lead #consecutive

collapse

Trim and collapse consecutive whitespace to a single space

3 releases

0.1.2 Nov 20, 2022
0.1.1 Nov 1, 2022
0.1.0 Nov 1, 2022

#1133 in Text processing

Download history 36/week @ 2024-07-20 30/week @ 2024-07-27 14/week @ 2024-08-03 20/week @ 2024-08-10 11/week @ 2024-08-17 2/week @ 2024-08-24 27/week @ 2024-08-31 14/week @ 2024-09-07 271/week @ 2024-09-14 1019/week @ 2024-09-21 870/week @ 2024-09-28 57/week @ 2024-10-05 530/week @ 2024-10-12 763/week @ 2024-10-19 638/week @ 2024-10-26 768/week @ 2024-11-02

2,714 downloads per month

MIT license

6KB
82 lines

Documentation

https://docs.rs/collapse

fn collapse(s: &str) -> String;

#[macro_use]
use collapse::*;

collapsed_eq!("two  spaces", "two spaces");
collapsed_eq!("new\r\nlines", "new\nlines");
collapsed_eq!(" lead \t tail \r", "lead tail");

lib.rs:

Functions and macros to compare strings, ignoring whitespace

No runtime deps