#case-folding #case-insensitive #caseless #starts_with #ends_with

no-std starts-ends-with-caseless

This crate provides the StartsWithCaseless trait and the EndsWithCaseless trait to extend types which implement AsRef<str> in order to do starts_with and ends_with case-insensitively

15 releases

✓ Uses Rust 2018 edition

new 0.6.3 Jul 6, 2020
0.5.4 Jun 27, 2020
0.5.3 Sep 17, 2019
0.5.1 Jul 29, 2019

#18 in No standard library

Download history 115/week @ 2020-03-15 85/week @ 2020-03-22 26/week @ 2020-03-29 84/week @ 2020-04-05 230/week @ 2020-04-12 306/week @ 2020-04-19 146/week @ 2020-04-26 114/week @ 2020-05-03 373/week @ 2020-05-10 391/week @ 2020-05-17 543/week @ 2020-05-24 525/week @ 2020-05-31 816/week @ 2020-06-07 96/week @ 2020-06-14 147/week @ 2020-06-21 114/week @ 2020-06-28

1,287 downloads per month
Used in 4 crates (3 directly)

MIT license

14KB
251 lines

Starts/Ends With Caseless

Build Status

This crate provides the StartsWithCaseless trait and the EndsWithCaseless trait to extend types which implement AsRef<str> in order to do starts_with and ends_with case-insensitively.

Examples

extern crate starts_ends_with_caseless;

use starts_ends_with_caseless::StartsWithCaseless;

assert_eq!(true, "foobar".starts_with_caseless_ascii("FoO"));

assert_eq!(true, "Maße 123".starts_with_caseless("MASSE"));
extern crate starts_ends_with_caseless;

use starts_ends_with_caseless::EndsWithCaseless;

assert_eq!(true, "foobar".ends_with_caseless_ascii("BaR"));

assert_eq!(true, "123 Maße".ends_with_caseless("MASSE"));

Multiple Prefixes or Suffixes

This crate also provides the StartsWithCaselessMultiple trait and the EndsWithCaselessMultiple trait to do starts_with_caseless and ends_with_caseless with multiple prefixes or suffixes.

Example

extern crate starts_ends_with_caseless;

use starts_ends_with_caseless::EndsWithCaselessMultiple;

assert_eq!(Some(1), "photo.jpg".ends_with_caseless_ascii_multiple(&[".png", ".jpg", ".gif"]));

No Std

Disable the default features to compile this crate without std. But the starts_with_caseless, ends_with_caseless, starts_with_caseless_multiple and ends_with_caseless_multiple methods will be disabled at this stage as well.

[dependencies.starts-ends-with-caseless]
version = "*"
default-features = false

Crates.io

https://crates.io/crates/starts-ends-with-caseless

Documentation

https://docs.rs/starts-ends-with-caseless

License

MIT

Dependencies