#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>

6 releases

0.1.5 May 5, 2021
0.1.4 Apr 22, 2021
0.1.3 Aug 3, 2020
0.1.2 Jul 29, 2020

#147 in Text processing

Download history 462/week @ 2021-08-11 270/week @ 2021-08-18 1518/week @ 2021-08-25 2039/week @ 2021-09-01 2054/week @ 2021-09-08 2885/week @ 2021-09-15 2730/week @ 2021-09-22 2284/week @ 2021-09-29 2614/week @ 2021-10-06 2532/week @ 2021-10-13 1344/week @ 2021-10-20 1889/week @ 2021-10-27 2549/week @ 2021-11-03 922/week @ 2021-11-10 1132/week @ 2021-11-17 1554/week @ 2021-11-24

6,683 downloads per month
Used in 7 crates (4 directly)

MIT license

26KB
526 lines

str Utils

CI

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

Examples

extern crate str_utils;

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

extern crate str_utils;

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