NicknameTransliterator/transliterator.go
profitroll 09166b9afe
All checks were successful
build
test
Added ukrainian characters
2023-04-14 12:01:08 +02:00

100 lines
1.7 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",
"Ё": "E",
"Ж": ")I(",
"З": "3",
"И": "u",
"І": "I",
"Ї": "I",
"К": "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",
"ё": "e",
"ж": ")I(",
"з": "3",
"и": "u",
"і": "i",
"ї": "i",
"к": "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)
}