Skip to content

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.

Notifications You must be signed in to change notification settings

nlburgin/trim_lines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages