Skip to content

Commit 0c3f3cd

Browse files
authored
Merge pull request #18 from Declarcall/master
Add special characters support
2 parents edcc0e1 + 0ec01fb commit 0c3f3cd

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

constants.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ var alphaNumToMorse = map[string]string{
2828
"X": "-..-",
2929
"Y": "-.--",
3030
"Z": "--..",
31-
".": ".-.-.-",
32-
",": "--..--",
33-
"?": "..--..",
34-
"/": "-..-.",
35-
"@": ".--.-.",
3631
"1": ".----",
3732
"2": "..---",
3833
"3": "...--",
@@ -43,6 +38,32 @@ var alphaNumToMorse = map[string]string{
4338
"8": "---..",
4439
"9": "----.",
4540
"0": "-----",
41+
".": ".-.-.-", // period
42+
":": "---...", // colon
43+
",": "--..--", // comma
44+
";": "-.-.-", // semicolon
45+
"?": "..--..", // question
46+
"=": "-...-", // equals
47+
"'": ".----.", // apostrophe
48+
"/": "-..-.", // slash
49+
"!": "-.-.--", // exclamation
50+
"-": "-....-", // dash
51+
"_": "..--.-", // underline
52+
"\"": ".-..-.", // quotation marks
53+
"(": "-.--.", // parenthesis (open)
54+
")": "-.--.-", // parenthesis (close)
55+
"()": "-.--.-", // parentheses
56+
"$": "...-..-", // dollar
57+
"&": ".-...", // ampersand
58+
"@": ".--.-.", // at
59+
"+": ".-.-.", // plus
60+
"Á": ".--.-", // A with acute accent
61+
"Ä": ".-.-", // A with diaeresis
62+
"É": "..-..", // E with acute accent
63+
"Ñ": "--.--", // N with tilde
64+
"Ö": "---.", // O with diaeresis
65+
"Ü": "..--", // U with diaeresis
66+
" ": ".......", // word interval
4667
}
4768

4869
// morseToAlphaNum is a mapping of Alpha numeric characters to Morse code

0 commit comments

Comments
 (0)