#line-string #trim #iterator #white-space #extremely #tiny #trims

trim_lines

An extremely simple and tiny library which provides an iterator over the lines of a string, trimmed of whitespace. It is a simple wrapper around the Lines iterator in std::str which trims the whitespace from each line.

3 unstable releases

0.2.0 May 25, 2019
0.1.1 Jul 23, 2017
0.1.0 Jul 23, 2017

#1419 in Text processing

ISC license

4KB
60 lines

trim_lines

NOTE: This crate is deprecated. You should be using map(str::trim) instead:

fn main() {
    let text = "    foo    \r\n    bar    \n   \n    baz    \n";
    let mut lines = text.lines().map(str::trim);
    assert_eq!(Some("foo"), lines.next());
    assert_eq!(Some("bar"), lines.next());
    assert_eq!(Some(""), lines.next());
    assert_eq!(Some("baz"), lines.next());
    assert_eq!(None, lines.next());
}

An extremely simple and tiny library which provides an iterator over the lines of a string, trimmed of whitespace. It is a simple wrapper around the Lines iterator in std::str which trims the whitespace from each line.

No runtime deps

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy