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

no-std str-utils

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

7 releases

0.1.6 Mar 19, 2022
0.1.5 May 5, 2021
0.1.4 Apr 22, 2021
0.1.3 Aug 3, 2020
0.1.2 Jul 29, 2020

#488 in Text processing

Download history 252/week @ 2022-11-27 265/week @ 2022-12-04 361/week @ 2022-12-11 226/week @ 2022-12-18 75/week @ 2022-12-25 152/week @ 2023-01-01 137/week @ 2023-01-08 134/week @ 2023-01-15 194/week @ 2023-01-22 250/week @ 2023-01-29 254/week @ 2023-02-05 205/week @ 2023-02-12 342/week @ 2023-02-19 281/week @ 2023-02-26 411/week @ 2023-03-05 393/week @ 2023-03-12

1,435 downloads per month
Used in 7 crates (5 directly)

MIT license

26KB
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