1 个不稳定版本
使用旧的 Rust 2015
| 0.1.0 | 2018 年 7 月 22 日 |
|---|
#15 在 #trim
8KB
86 行
用于修剪 &str 和 String 前缀和后缀的扩展 trait。
提供的方法仅当给定的模式匹配确切的次数时才进行修剪,否则它们返回未修改的 &str。这可以用于原始解析和文本分析。
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:
用于修剪 &str 和 String 前缀和后缀的扩展 trait。
提供的方法仅当给定的模式匹配确切的次数时才进行修剪,否则它们返回未修改的 &str。这可以用于原始解析和文本分析。