title: Translating strings character by character
body: <p>How should I go about implementing a method that gets a String composed of Latin characters to translate it into a String composed of a different set of characters, let's say Cyrillic.</p>
  
  <p>Here's how it's done in PHP for example:</p>
  
  <pre><code>function latin_to_cyrillic($string)
  {
   $array = array(
    "а" =&gt; "a",
    "б" =&gt; "b",
    "в" =&gt; "v",
    "г" =&gt; "g",
    "д" =&gt; "d",
    "е" =&gt; "e",
    "ж" =&gt; "zh",
    "з" =&gt; "z",
    "и" =&gt; "i",
    "й" =&gt; "y",
    "к" =&gt; "k",
    "л" =&gt; "l",
    "м" =&gt; "m",
    "н" =&gt; "n",
    "о" =&gt; "o",
    "п" =&gt; "p",
    "р" =&gt; "r",
    "с" =&gt; "s",
    "т" =&gt; "t",
    "у" =&gt; "u",
    "ф" =&gt; "f",
    "х" =&gt; "h",
    "ц" =&gt; "ts",
    "ч" =&gt; "ch",
    "ш" =&gt; "sh",
    "щ" =&gt; "sht",
    "ь" =&gt; "y",
    "ъ" =&gt; "a",
    "ю" =&gt; "yu",
    "я" =&gt; "ya",
    "А" =&gt; "A",
    "Б" =&gt; "B",
    "В" =&gt; "V",
    "Г" =&gt; "G",
    "Д" =&gt; "D",
    "Е" =&gt; "E",
    "Ж" =&gt; "Zh",
    "З" =&gt; "Z",
    "И" =&gt; "I",
    "Й" =&gt; "Y",
    "К" =&gt; "K",
    "Л" =&gt; "L",
    "М" =&gt; "M",
    "Н" =&gt; "N",
    "О" =&gt; "O",
    "П" =&gt; "P",
    "Р" =&gt; "R",
    "С" =&gt; "S",
    "Т" =&gt; "T",
    "У" =&gt; "U",
    "Ф" =&gt; "F",
    "Х" =&gt; "H",
    "Ц" =&gt; "Ts",
    "Ч" =&gt; "Ch",
    "Ш" =&gt; "Sh",
    "Щ" =&gt; "Sht",
    "Ь" =&gt; "Y",
    "Ъ" =&gt; "A",
    "Ю" =&gt; "Yu",
    "Я" =&gt; "Ya",
    "–" =&gt; "-");
  
   return str_replace(array_values($array), array_keys($array), $string);
  
  }
  </code></pre>