Hello everyone i have this code which is below but i am stuck with how i can printout how many tokens are in the first line could anyone give me some ideas please thanks
sorry do not know why it came out like that import java.io.*; import java.util.*; import java.lang.*; import java.util.StringTokenizer.*; import java.sql.*;
try { Vector v2 = new Vector(100); Vector v = new Vector(100); FileReader file = new FileReader("Work.csv"); BufferedReader buff = new BufferedReader(file); String line = buff.readLine(); StringTokenizer s = null; boolean eof = false;
while (!eof){ s = new StringTokenizer(line.trim(),",",true); boolean lastToken = true;
while (s.hasMoreTokens()) {
token = s.nextToken(); if (lastToken){ if (token.equals(",")) { v.add(""); } lastToken = false; } if (! token.equals(",")) { v.add(token); } else { if (currentToken.equals(",")) { v.add("");
} } currentToken = token;
} if (token.equals(",")) { v.add(""); }
line = buff.readLine(); if (line == null){ eof = true;} }