#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

#890 in Text processing

Download history 226/week @ 2024-11-20 187/week @ 2024-11-27 189/week @ 2024-12-04 347/week @ 2024-12-11 254/week @ 2024-12-18 44/week @ 2024-12-25 140/week @ 2025-01-01 175/week @ 2025-01-08 156/week @ 2025-01-15 165/week @ 2025-01-22 188/week @ 2025-01-29 318/week @ 2025-02-05 220/week @ 2025-02-12 140/week @ 2025-02-19 146/week @ 2025-02-26 91/week @ 2025-03-05

608 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