File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes MorseCode Translation: decoding incorrectly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "MorseCode Translation: decoding incorrectly" Watch "MorseCode Translation: decoding incorrectly" New topic
Author

MorseCode Translation: decoding incorrectly

Ciaran Mooney
Ranch Hand

Joined: Jan 21, 2013
Posts: 65

Hey,
My code is encoding a message in english to morsecode fine with a multithread server app, the encoded morseCode is then sent onto a client but the cleint is not decoding correct.
If I send 'Hello' to server it reruns ' …. . .-.. .-.. —' which appears right.
When …. . .-.. .-.. — is sent to client 'L I' is returned...
Have spent a while playing with his and searching around the web but i suspect its the way i am using the Stringtokeinizer, can't follow how it breaks the more code down into tokens..

English to MorseCode code:

Any input appreciated my head is melted!



morseCode to English Code:


I love deadlines, I love the whooshing sound they make as they fly by...
Ciaran Mooney
Ranch Hand

Joined: Jan 21, 2013
Posts: 65

Got ish,
1. Stupidly the encoding english to morsecode string arrays did'nt match the morsecode to english array but now they do,
2. Had to use a string split with 3 space reg expression (" ") to seperate each morse code word as below
Crazy bananas

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Well done on figuring out the problem yourself
This question is not exactly applet related. I will move it to a more appropriate forum for you


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MorseCode Translation: decoding incorrectly
 
Similar Threads
Please help me with this problem.
transform and change the words of a file.txt with java
Java Word Count
A small request
Using StringTokenizer to perform Arithmetic Operations on Strings