1 unstable release
Uses old Rust 2015
0.1.0 | Jul 22, 2018 |
---|
#6 in #text-analysis
8KB
86 lines
Extension trait for controlled trimming of prefixes and suffixes of &str
and String
.
Provided methods trim only if the given pattern matches exact number of times, otherwise they return
the unmodified &str
. This can be used for primitive parsing and text analysis.
assert_eq!(Ok("trimmed"), "not trimmed".trim_left_matches_exactly("not ", 1));
assert_eq!(Err("not trimmed"), "not trimmed".trim_left_matches_exactly("very ", 1));
assert_eq!(Ok("trimmed"), "tttrimmed".trim_left_matches_exactly('t', 2));
lib.rs
:
Extension trait for controlled trimming of prefixes and suffixes of &str
and String
.
Provided methods trim only if the given pattern matches exact number of times, otherwise
they return the unmodified &str
. This can be used for primitive parsing and text analysis.