hemoglobin/lib.rs
1#![warn(clippy::pedantic)]
2#![warn(clippy::nursery)]
3
4//! Hemolymph is a library containing data structures and functions useful for the card game Bloodless. It is used by [Hemolymph](http://hemolymph.net), the official card search engine.
5//!
6//! The two datastructures are `Card`, which represents a card and `CardId`, which represents a card identity. Card identities in this library do not represent card identities as defined by the game's rules, but rather as a more general structure for identifying cards.
7//!
8//! This library contains the search functions used by Hemolymph.
9
10pub mod cards;
11pub mod numbers;
12
13/// Only handles lowercase because it'll be applied after `to_lowercase`
14#[must_use]
15pub fn clean_ascii(string: &str) -> String {
16 let string = string.to_lowercase();
17 clean_ascii_keep_case(&string)
18}
19
20/// Only handles lowercase because it'll be applied after `to_lowercase`
21#[must_use]
22pub fn clean_ascii_keep_case(string: &str) -> String {
23 let string = string.replace('ä', "a");
24 let string = string.replace('ë', "e");
25 let string = string.replace('ï', "i");
26 let string = string.replace('ö', "o");
27 let string = string.replace('"', "");
28 let string = string.replace('\'', "");
29 let string = string.replace('.', "");
30 let string = string.replace(',', "");
31 string.replace('ü', "u")
32}