/* * Stocks : A start at parsing the Portfolio file. * * Parke Godfrey * */ import java.io.*; import java.util.Scanner; // import type.lib.*; public class Stocks { public static void main(String[] args) throws Exception { PrintStream output = System.out; // Scanner input = new Scanner(System.in); Scanner stockIn = new Scanner( new FileReader("lab8data.txt") ); String text = ""; while (stockIn.hasNext()) { text += stockIn.nextLine(); } text = text.trim(); text = text.replaceFirst( "^<[^>]*>", "" ); text = text.trim(); text = text.replaceFirst( "^(.*).*$", "$1"); text = text.trim(); String invS = ""; while (text.matches( "^.*?")) { invS = text.replaceFirst( "^(.*?).*$", "$1"); text = text.replaceFirst( "^.*?", ""); output.println("Inv: " + invS); text = text.trim(); } output.println(text); } }