4 Replies Latest reply: Oct 28, 2006 1:43 PM by 807598 RSS

    problems with charAt()

    807598
      Alright, I'm relatively new to Java, and I can't figure out why I can't get this working at all... heres what i have..
      public static void Processor (String pre_process) {
                int n, diff_number = 0;
                while (n <= pre_process.length() - 1) {
                     if (pre_process.charAt(n) == "+") {
                          Temp_Value = Double.parseDouble(pre_process.substring(diff_number, (n-1)));
                     }
                     n++;
                }
           }
      basically this is the beginning of a method that would process something like a calculator, that would loop and use charAt() for each index, and whenever it hits an operator, make parse all the numbers before then so that I can eventually do the operation (addition, subtraction, etc) on those numbers. But when I try to compile, its saying "incomparable types: char and java.lang.String" and I can't seem to figure out how to get it to work... anybody feel like helping? I'd appreciate it unbelievably. Thanks