6 Replies Latest reply: Oct 18, 2010 5:06 PM by YoungWinston RSS

    Java Question, Parsing multiple strings into one integer

    770463
      I have some code in a method such as:
      public Implement(String strNote) throws InvalidNoteStringException
           {
                super(strNote);
                
                String note[] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
                
                String c = null;
                String d = null;
                String e;
                
                if (strNote.length() == 1)
                {
                     c = strNote.substring(0,1);
                }
                
                else if (strNote.length() == 2)
                {
                     c = strNote.substring(0, 1);
                     d = strNote.substring(1,2);          
                }
                
                else if (strNote.length() == 3)
                {
                     c = strNote.substring(0, 1);
                     d = strNote.substring(1,2);
                     e = strNote.substring(2,3);
                     
                }
                
                for (int i = 0; i <= 11; i++)
                {
                     if (note.equals(c) && note[i].equals(d))
                     {
                          try
                          {
                               
                          }
                          catch(Exception error)
                          {
                               System.err.println(error);
                          }
                     }
                }
           }
      In the try statement I need to do something like:
      
      i = Integer.parseint(c,d,e).....Now I am thinking of storing c,d and e into an array....how ever I am unsure how to do this...
      
      Suggestions?
      
      Note: yes this is a home work questions, no I am not looking for the answer, just...Suggestions, examples, resource material?