Crate leetspeak

source ·

Enums

The level determines the degree of translation. Level::One replaces a few common letters with numbers; Level::Two replaces most letters with either single-digit numbers multi-character strings that use symbols to represent characters; Level::Three is the same as level 2, except it replaces all letters in the original text. Below are examples of the translation output using the pangram “sphinx of black quartz, judge my vow”

Functions

Translates text into leetspeak, returning a new string. Since each English letter is mapped to multiple leetspeak letters, each leetspeak letter is chosen from its mapping at random using rand::thread_rng(). This means that the result of translate() is non-deterministic (i.e. translating the same text may return different results). If you want deterministic (non-random) translation, use translate_with_level() or translate_custom(). The translation table is based on wikipedia/leet
Translates text into leetspeak using a custom mapping table (type HashMap<char,String>), returning a new string. Characters not included in the mapping table are not changed.
Translates text into leetspeak using the translation level level, returning a new string. Level::One replaces a few common letters with numbers; Level::Two replaces most letters with either single-digit numbers multi-character strings that use symbols to represent characters; Level::Three is the same as level 2, except it replaces all letters in the original text.