#string #ascii #starts-with #ends-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

#651 in Text processing

Download history 142/week @ 2023-11-20 176/week @ 2023-11-27 247/week @ 2023-12-04 332/week @ 2023-12-11 324/week @ 2023-12-18 24/week @ 2023-12-25 82/week @ 2024-01-01 139/week @ 2024-01-08 156/week @ 2024-01-15 73/week @ 2024-01-22 221/week @ 2024-01-29 172/week @ 2024-02-05 158/week @ 2024-02-12 135/week @ 2024-02-19 206/week @ 2024-02-26 91/week @ 2024-03-04

595 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