2 Replies Latest reply: Aug 26, 2008 5:05 PM by 800351 RSS

    String.replaceALL acting oddly

      I searched the forums and did some googling, but I can't seem to find anyone who has this issue. Here is the beginning of the file with relevant global varaiables:

      public class Parser {
          private String MISSING;
          private String MISSINGVALUE = ".";
          private Vector CriteriaData = new Vector();
          public Parser() {
      Here is the line of code that is acting oddly:
      Cells[i] = Cells.replaceAll(MISSING,MISSINGVALUE);
      I stopped the code on this line within netbeans.  At this time:
      Cells is a String[] of length 15.  The element (i) of interest is 11: Cells[11] = "./."
      MISSING is a string = "." (this was set in another section of the code).
      So the original string is "./." and I am trying to replace each "." with a "." (sometimes MISSING and MISSINGVALUE are not the same).
      The odd thing is that the new string becomes "...".  Why does this happen?  If MISSINGVALUE is something else like "NA" it this line does not replace the "/" with a "." any thoughts?
      Let me know if you need any more detailed information.