NicknameTransliterator/transliterator.go
2023-04-13 15:57:21 +02:00

94 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"encoding/json"
"fmt"
"os"
"strings"
)
func main() {
jsonData := `
{
"А": "A",
"Б": "6",
"В": "B",
"Г": "r",
"Д": "D",
"Е": "E",
"Ё": "E",
"Ж": ")I(",
"З": "3",
"И": "u",
"К": "K",
"Л": "Jl",
"М": "M",
"Н": "H",
"О": "O",
"П": "n",
"Р": "P",
"С": "C",
"Т": "T",
"У": "Y",
"Ф": "F",
"Х": "X",
"Ц": "u",
"Ч": "4",
"Ш": "W",
"Щ": "W",
"Ъ": "",
"Ы": "bl",
"Ь": "b",
"Э": "E",
"Ю": "I-O",
"Я": "9l",
"а": "a",
"б": "6",
"в": "b",
"г": "r",
"д": "g",
"е": "e",
"ё": "e",
"ж": ")I(",
"з": "3",
"и": "u",
"к": "k",
"л": "Jl",
"м": "m",
"н": "H",
"о": "o",
"п": "n",
"р": "p",
"с": "c",
"т": "T",
"у": "y",
"ф": "f",
"х": "x",
"ц": "u",
"ч": "4",
"ш": "w",
"щ": "w",
"ъ": "",
"ы": "bl",
"ь": "b",
"э": "e",
"ю": "I-o",
"я": "9l"
}
`
text := strings.Join(os.Args[1:], " ")
var symbols map[string]interface{}
json.Unmarshal([]byte(jsonData), &symbols)
for i, character := range symbols {
text = strings.ReplaceAll(text, i, fmt.Sprint(character))
}
fmt.Println(text)
}