reprogl
28 строк · 441.0 Байт
1package transliterator2
3import (4"strings"5"unicode"6)
7
8func Transliterate(text string) string {9var replacement strings.Builder10
11runes := []rune(text)12for _, symbol := range runes {13if symbol < unicode.MaxASCII {14replacement.WriteString(string(symbol))15
16continue17}18
19if symbol > 0x399 {20idx := int(symbol - 0x400)21if idx < len(x004) {22replacement.WriteString(x004[idx])23}24}25}26
27return replacement.String()28}
29