1 Reply Latest reply on Oct 7, 2006 7:23 AM by 807607

    Problem with indexOf() method

      I'm facing a problem while trying to format a string according to my criteria. I need to make a substring of the string giving the position using indexOf method. But the method isn't working well as I need. Given below is the code.......

      temp1 = 3O|1||V06080000210R^A^04|^^^106^HBsAg^UNDILUTED|R||||||||||||||||||||F<CR><ETX>61<CR><LF>

      I need to cut the string from ^'s 6th position+1 until 7th position-1.

      I'm using indexOf method to draw the solution as given below....

      int tst = temp1.indexOf('^',5);
      int tst1 = temp1.indexOf('^',6);

      Problem is it's not working. Can someone help me draw the solution?