Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. fn main() {
  2. let phrase = "тест";
  3. for c in phrase.to_lowercase().chars() {
  4. if let Some(t) = map(c) {
  5. print!("{}", t);
  6. } else {
  7. print!("{}", c);
  8. }
  9. }
  10.  
  11. println!();
  12. }
  13.  
  14. fn map(c: char) -> Option<&'static str> {
  15. match c {
  16. 'а' => Some(":lla:"),
  17. 'б' => Some(":llb:"),
  18. 'в' => Some(":llv:"),
  19. 'г' => Some(":llg:"),
  20. 'д' => Some(":lld:"),
  21. 'е' => Some(":lle:"),
  22. 'ё' => Some(":llyo:"),
  23. 'ж' => Some(":llzz:"),
  24. 'з' => Some(":llz:"),
  25. 'и' => Some(":lli:"),
  26. 'й' => Some(":llii:"),
  27. 'к' => Some(":llk:"),
  28. 'л' => Some(":lll:"),
  29. 'м' => Some(":llm:"),
  30. 'н' => Some(":lln:"),
  31. 'о' => Some(":llo:"),
  32. 'п' => Some(":llp:"),
  33. 'р' => Some(":llr:"),
  34. 'с' => Some(":lls:"),
  35. 'т' => Some(":llt:"),
  36. 'у' => Some(":llu:"),
  37. 'ф' => Some(":llf:"),
  38. 'х' => Some(":llh:"),
  39. 'ц' => Some(":llc:"),
  40. 'ч' => Some(":llch:"),
  41. 'ш' => Some(":llsh:"),
  42. 'щ' => Some(":llssh:"),
  43. 'ъ' => Some(":llis:"),
  44. 'ы' => Some(":lliii:"),
  45. 'ь' => Some(":llik:"),
  46. 'э' => Some(":llee:"),
  47. 'ю' => Some(":lluu:"),
  48. 'я' => Some(":llya:"),
  49. '0' => Some(":ll:"),
  50. '1' => Some(":ll1:"),
  51. '2' => Some(":ll2:"),
  52. '3' => Some(":ll3:"),
  53. '4' => Some(":ll4:"),
  54. '5' => Some(":ll5:"),
  55. '6' => Some(":ll6:"),
  56. '7' => Some(":ll7:"),
  57. '8' => Some(":ll8:"),
  58. '9' => Some(":ll9:"),
  59. ',' => Some(":llcomma:"),
  60. '.' => Some(":lldot:"),
  61. '!' => Some(":llatt:"),
  62. '?' => Some(":llques:"),
  63. _ => None
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement