Hello all, I would appreciate some pointers to how I can accomplish the
following
I am using the following code in an object.
**************** start java code ****************************
while ( (line = br.readLine()) != null ) {
StringTokenizer st = new StringTokenizer( line, "," );
while(st.hasMoreTokens()){
token = st.nextToken();
if (token.equalsIgnoreCase (city)) {
System.out.println("\n Found
"+city+"!\n"+line+"\n");
}
}
}
**************end java code ********************************
The file that this reads is formatted like this
*************start data*********************************
city state address firsttime outofstate color initials
CHARLESTON, SC, 125 FARRELL ST., YES, NO, RED, BD
SUMMERVILLE, SC, 307 MAIN ST., YES, NO, BLUE, JK
*************end data**********************************
the above code compares a given string to every element of the file,
split on the "," I need to assign each of the field
into an array where city() state() address() etc. are each in an array
of their own. that way I can not only search on each array individually,
but I can also rewrite the file and otherwise manipulate the data.
tia
--
Rick Bauman
Lowcountry Linux
http://www.lowcountry.net/