#trim #white-space #string #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

#1230 in Text processing

Download history 23/week @ 2024-09-04 15/week @ 2024-09-11 791/week @ 2024-09-18 910/week @ 2024-09-25 483/week @ 2024-10-02 193/week @ 2024-10-09 690/week @ 2024-10-16 726/week @ 2024-10-23 634/week @ 2024-10-30 834/week @ 2024-11-06 894/week @ 2024-11-13 2011/week @ 2024-11-20 1978/week @ 2024-11-27 2230/week @ 2024-12-04 1636/week @ 2024-12-11 1034/week @ 2024-12-18

7,239 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