Import teepee code

This commit is contained in:
Joscha 2024-03-05 00:47:32 +01:00
parent 6b62c3fd54
commit a2867b7188
9 changed files with 1439 additions and 5 deletions

View file

@ -0,0 +1,18 @@
const CODE_PAGE_437_SECOND_HALF: &str = concat!(
"ÇüéâäàåçêëèïîìÄÅ",
"ÉæÆôöòûùÿÖÜ¢£¥₧ƒ",
"áíóúñѪº¿⌐¬½¼¡«»",
"░▒▓│┤╡╢╖╕╣║╗╝╜╛┐",
"└┴┬├─┼╞╟╚╔╩╦╠═╬╧",
"╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀",
"αßΓπΣσµτΦΘΩδ∞φε∩",
"≡±≥≤⌠⌡÷≈°∙·√ⁿ²■",
);
fn is_safe(c: char) -> bool {
c.is_ascii_graphic() || c == ' ' || c == '\n' || CODE_PAGE_437_SECOND_HALF.contains(c)
}
pub fn sanitize(text: &str) -> String {
text.chars().filter(|&c| is_safe(c)).collect::<String>()
}