Skip to content

More advanced versions of String::retain

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

DJMcNab/retain_more

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retain More

A version of String::retain which provides access to the rest of the string

use retain_more::RetainMore as _;

fn redact(input: &mut String) {
    input.retain_after(|current: char, rest: &str| {
        match (current, rest.chars().next()) {
            ('-', Some(c)) => !c.is_ascii_digit(),
            (c, _) => !c.is_ascii_digit(),
            _ => true,
        }
    });
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

More advanced versions of String::retain

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages