Expand description
§str Utils
This crate provides some traits to extend types which implement AsRef<[u8]> or AsRef<str>.
§Examples
use str_utils::*;
assert_eq!(true, "foobar".starts_with_ignore_ascii_case("FoO"));
assert_eq!(Some(1), "photo.jpg".ends_with_ignore_ascii_case_multiple(&[".png", ".jpg", ".gif"]));
assert_eq!(true, "http".eq_ignore_ascii_case_with_uppercase("HTTP")); // faster than `eq_ignore_ascii_case`
assert_eq!(true, "foobar".starts_with_ignore_ascii_case("FoO"));
assert_eq!("here is a ZERO_WIDTH_SPACE -> ".len() - 3, "here is a ZERO_WIDTH_SPACE -> ".remove_all_invisible_characters().len());
assert_eq!(r"foo\% b\_r", r"foo% b_r".escape_ascii_characters(b'\\', b"%_"));§No Std
Disable the default features to compile this crate without std.
[dependencies.str-utils]
version = "*"
default-features = falseTraits§
- Ends
With Ignore Ascii Case - To extend types which implement
AsRef<[u8]>to haveends_with_ignore_ascii_case,ends_with_ignore_ascii_case_with_lowercaseandends_with_ignore_ascii_case_with_uppercasemethods. - Ends
With Ignore Ascii Case Multiple - To extend types which implement
AsRef<[u8]>to haveends_with_ignore_ascii_case_multiple,ends_with_ignore_ascii_case_with_lowercase_multipleandends_with_ignore_ascii_case_with_uppercase_multiplemethods. - Ends
With Ignore Case - To extend types which implement
AsRef<str>to have aends_with_ignore_casemethod. - Ends
With Multiple - To extend types which implement
AsRef<[u8]>to have aends_with_multiplemethod. - EqIgnore
Ascii Case - To extend types which implement
AsRef<[u8]>to haveeq_ignore_ascii_case_with_lowercaseandeq_ignore_ascii_case_with_uppercasemethods. - EqIgnore
Ascii Case Multiple - To extend types which implement
AsRef<[u8]>to haveeq_ignore_ascii_case_multiple,eq_ignore_ascii_case_with_lowercase_multipleandeq_ignore_ascii_case_with_uppercase_multiplemethods. - EqIgnore
Case - To extend types which implement
AsRef<str>to have aeq_ignore_casemethod. - EqMultiple
- To extend types which implement
AsRef<[u8]>to have aeq_multiplemethod. - Escape
Characters std - To extend types which implement
AsRef<str>to haveescape_charactersandescape_ascii_charactersmethod. - Remove
Invisible Characters std - To extend types which implement
AsRef<str>to haveremove_all_invisible_charactersmethod. - Starts
With Ignore Ascii Case - To extend types which implement
AsRef<[u8]>to havestarts_with_ignore_ascii_case,starts_with_ignore_ascii_case_with_lowercaseandstarts_with_ignore_ascii_case_with_uppercasemethods. - Starts
With Ignore Ascii Case Multiple - To extend types which implement
AsRef<[u8]>to havestarts_with_ignore_ascii_case_multiple,starts_with_ignore_ascii_case_with_lowercase_multipleandstarts_with_ignore_ascii_case_with_uppercase_multiplemethods. - Starts
With Ignore Case - To extend types which implement
AsRef<str>to have astarts_with_ignore_casemethod. - Starts
With Multiple - To extend types which implement
AsRef<[u8]>to have astarts_with_multiplemethod.