java - Morse code decoding - 1 word -


i working on encoding/decoding morse code program in java. i'm having trouble decoding. i'm working strictly uppercase alphabet , 1 word. no sentences. when debugged, program infinitely loops between lines 1 & 2. here have far:

m[0] = .-; m[25] = --..;  string decode (string m) {     m = m + " ";     string temp = "";     string word = "";      {         temp = m.substring(0,m.indexof(" "));  //line 1           (int = 0; < m.length(); i++) {             if (temp.equals(m[i])){      // line 2                 word += (char)i + 'a';                 m = m.substring(m.indexof(" " + 1));             }          }     } while (m.contains(" "));      return word; } 

try changing line inside loop this:

 m = m.substring(m.indexof(" ")+1); 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -