#string #transform #lower-case #upper-case #list #separated #character

nightly macro choice_nocase

Transforms a string as a list of strings separated by | where all combinations of character cases are generated. By construction first one is fully uppercase, second one is fully lowercase.

3 unstable releases

0.2.0 Nov 4, 2023
0.1.2 Oct 10, 2023
0.1.1 Oct 10, 2023

#13 in #separated

Download history 44/week @ 2024-11-13 35/week @ 2024-11-20 26/week @ 2024-11-27 37/week @ 2024-12-04 38/week @ 2024-12-11 12/week @ 2024-12-18 6/week @ 2025-01-01 22/week @ 2025-01-08 5/week @ 2025-01-15 3/week @ 2025-01-22 21/week @ 2025-02-05 7/week @ 2025-02-12 28/week @ 2025-02-19 15/week @ 2025-02-26

71 downloads per month
Used in 12 crates (via cpclib-asm)

MIT license

7KB
91 lines

Transforms a string as a list of strings separated by `|`` where all combinations of character cases are generated. By construction first one is fully uppercase, second one is fully lowercase.

The following call:

match value.as_ref() {
	choice_nocase!("hi") => println!("good"),
	_ => println!("bad")
};

corresponds to a similar macro expansion:

match value.as_ref() {
	"HI" | "hi" | "Hi" | "hI" => println!("good"),
	_ => println!("bad")
};

Dependencies

~195–610KB
~15K SLoC