qx_rs_str 0.0.0

quick str util in rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn check_or_remove_prefix<'a>(text: &'a str, prefix: &str) -> &'a str {
    if text.starts_with(prefix) {
        &text[prefix.len()..]
    } else {
        text
    }
}
pub fn check_or_remove_suffix<'a>(text: &'a str, suffix: &str) -> &'a str {
    if text.ends_with(suffix) {
        &text[..(text.len() - suffix.len())]
    } else {
        text
    }
}