Write in Morse Code
Morse code is a way of transmitting text through a series of unique sounds or lights represented by dots and dashes, represented by "." and "-". Write a function that takes an English text and outputs the corresponding Morse code.
One famous piece of Morse code is "… — …", a distress signal for "SOS" that stands for "Save Our Souls".
What Your Function Should Do
Write a function ToMorseCode that takes a string of English text and outputs the Morse code translation. Use "/" to separate words.
In[1]:=
In[2]:=
To avoid ambiguity, separate each character with a single whitespace character:
In[3]:=
Here are all positions of whitespace characters in the previous example:
In[4]:=
![StringPosition[%, " "][[All, 1]]](https://www.wolframcloud.com/objects/wolframchallenges/public/nb/export/WriteInMorseCode/HTMLFiles/MoreDetails_7.gif)
Treat uppercase and lowercase characters the same:
In[5]:=
In[6]:=
More Examples
A long piece of text:
In[7]:=
Things You May Find Useful
The following list, morseAlphabet, is a list of the letters of the Morse code alphabet, in alphabetical order (a–z):
In[8]:=
Categories: Start Here Words and Linguistics
Contributed by: Wolfram Research