I have a sdf file, i wan to retrieve product numbers from the file. However, when i print out, it only printed out the first product number(02230416222D). There are supposed to be 2 products numbers, does anyone knows why my program only loop 1 time?
This is how the sdf file looks like:
This is my java program:Code:-ISIS- 02230416222D 17 18 0 0 0 0 0 0 0 0999 V2000 ...... $$$$//this is end of the first product -ISIS- 02230416222D 17 18 0 0 0 0 0 0 0 0999 V2000 ...... $$$$ //this is the end of second product
Code:Scanner inFile = new Scanner(new FileReader("merlin3.sdf")); while(inFile.hasNext("-ISIS-")) { String line = inFile.nextLine(); String pdt = line.replaceAll("-ISIS-",""); String pdtNo = pdt.trim(); System.out.println(pdtNo); }


Reply With Quote