Hello everyone, I am using the following code in a program I am writing:
BufferedReader br = new BufferedReader( new FileReader(inFile));
while ( (line = br.readLine()) != null ) {
StringTokenizer st = new StringTokenizer( line, ":" );
while(st.hasMoreTokens()){
token = st.nextToken();
The inFile has the following structure:
somename:somechars:somevalue:trueorfalse:someaddress:somecity:somestate:somezip
the inFile will have anywhere from 1 to 10,000 entries
while reading each line I would like to assign each field a variable, do
something to the fields on that line, then start over again on the next
line. that way I could manipulate the file in different formats for
different purposes, for example if somecity=charleston then I could
write that to a log, but if somestate=calif then I could skip writing
the line.
any ideas would be appreciated.
--
Rick Bauman
Lowcountry Linux
http://www.lowcountry.net/