Skip to content
Advertisement

Splitting a text file into two parallel arrays (java)

I have a file that’s a translation of morse code patterns into the alphabet.

I need to separate this file into keys and values, in two separate arrays.

I am hoping someone can show me the basic algorithm that would generate a similar result so I can model my code after it.

How would I split the left section into it’s own array as well as the right section into its own array? [1]: https://i.stack.imgur.com/X3i99.png

Advertisement

Answer

Read the file in, and then go character by character comparing them to an array you construct of possible characters. Construct two other arrays, and if the comparison matches one or the other put the character in the correct array based on the comparison.

JavaScript

Reading files something like

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement