How Do I Convert Morse Code to Normal Text?

Hello Inventors,
I'm working on App where I have to convert Normal Text to Morse Code and Morse Code to Normal Text, I can convert my normal text to morse using this code.


But I'm not able to convert my Morse code to Normal Text
Here is my code

Because in morse code is I use only a or only b letter this will convert fine but if I will use here
bb so this will not work because a = .- and b = -... if I use bb then I'm getting the result is -..a...
Please help me to resolve this problem
Thank You
My .aia file
MorseCodeApp.aia (3.2 KB)

2 Likes

Use a space after each code.
._space

2 Likes

working for some letter, not for all like bb is fine but for hi result is like ...e.e

1 Like

First, you have to convert the morsea string to a list. Therefore, insert spaces between the letters of Morsea. Use the "split at spaces" text block to create the list. Then you can loop through and get each item in the list to be decoded. The easiest way to decode and encode is with two lists. The first list contains the alphabet, the second list contains periods and dashes in the order of the alphabet. When you are reading Morsea characters, search for this character on the morsea list, get the index of this character and then use this index to get a letter from the alphabet list.

1 Like

Advice from the old Forum: https://groups.google.com/g/mitappinventortest/search?q=morse%20code

This following csv files might help. Convert them to Lists and use Patryk's advice

The morseCharacters csv string is:

'/','.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..-','...-','.--','-..-','-.--','--..','.----','..---','...--','....-','.....','-....',--...','---..','----.','-----',.-.-.-',..--..',-...-'

The letters/numerals/punctuation ( morseLetters ) are:

/ ,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,.,?,/

1 Like

There is a fairly new text block for replacing text, with a dictionary of replacements as input, along with an option to replace the longest substrings first.

That would solve your problem, all in one shot.

1 Like

Out of boredom, I made an example application.
AppMorseCode.aia (17.0 KB)

6 Likes

Thanks For The Answer All Of The Community!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.