Enums§
- Level
- 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§
- translate
- 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 usingrand::thread_rng()
. This means that the result oftranslate()
is non-deterministic (i.e. translating the sametext
may return different results). If you want deterministic (non-random) translation, usetranslate_with_level()
ortranslate_custom()
. The translation table is based on wikipedia/leet - translate_
custom - Translates
text
into leetspeak using a custom mapping table (typeHashMap<char,String>
), returning a new string. Characters not included in the mapping table are not changed. - translate_
with_ level - Translates
text
into leetspeak using the translation levellevel
, 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.