#string #ascii #ends-with #starts-with #caseless

no-std str-utils

This crate provides some traits to extend types which implement AsRef<[u8]> or AsRef<str>

8 releases

0.1.7 Sep 11, 2023
0.1.6 Mar 19, 2022
0.1.5 May 5, 2021
0.1.4 Apr 22, 2021
0.1.2 Jul 29, 2020

#492 in Text processing

Download history 316/week @ 2024-08-10 159/week @ 2024-08-17 237/week @ 2024-08-24 295/week @ 2024-08-31 226/week @ 2024-09-07 170/week @ 2024-09-14 175/week @ 2024-09-21 285/week @ 2024-09-28 246/week @ 2024-10-05 178/week @ 2024-10-12 114/week @ 2024-10-19 204/week @ 2024-10-26 116/week @ 2024-11-02 209/week @ 2024-11-09 247/week @ 2024-11-16 176/week @ 2024-11-23

785 downloads per month
Used in 7 crates (5 directly)

MIT license

27KB
523 lines

str Utils

CI

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`

Crates.io

https://crates.io/crates/str-utils

Documentation

https://docs.rs/str-utils

License

MIT


lib.rs:

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`

Dependencies

~110KB