Reno2005
12-10-2005, 11:55 AM
I am currently using StringTokenizer to read in an html file into lists but after each token is read into a list (listArea1 etc), i would like to add the same token into 1 of 4 arrays i.e.
listArea1 data is inserted into Array1,
listArea2 data is inserted into Array2,
listArea3 data is inserted into Array3,
listArea4 data is inserted into Array4,
This is where im at but i dont think im doing this correctly?
ArrayList array1 = new ArrayList ();
ArrayList array2 = new ArrayList ();
ArrayList array3 = new ArrayList ();
ArrayList array4 = new ArrayList ();
try
{
file = new DataInputStream((new URL(url)).openStream());
data = file.readLine();
clearLists();
while (data != null)
{
if(x >= start && x <= end)
{
StringTokenizer st = new StringTokenizer(data);
while(st.hasMoreElements())
{
listArea1.add(st.nextToken());
array1.add(st); //?Is this right?
listArea2.add(st.nextToken());
listArea3.add(st.nextToken());
listArea4.add(st.nextToken());
}
}
data = file.readLine();
x++;
}
}
Any help to get me onto the right track? :confused:
Thanks
listArea1 data is inserted into Array1,
listArea2 data is inserted into Array2,
listArea3 data is inserted into Array3,
listArea4 data is inserted into Array4,
This is where im at but i dont think im doing this correctly?
ArrayList array1 = new ArrayList ();
ArrayList array2 = new ArrayList ();
ArrayList array3 = new ArrayList ();
ArrayList array4 = new ArrayList ();
try
{
file = new DataInputStream((new URL(url)).openStream());
data = file.readLine();
clearLists();
while (data != null)
{
if(x >= start && x <= end)
{
StringTokenizer st = new StringTokenizer(data);
while(st.hasMoreElements())
{
listArea1.add(st.nextToken());
array1.add(st); //?Is this right?
listArea2.add(st.nextToken());
listArea3.add(st.nextToken());
listArea4.add(st.nextToken());
}
}
data = file.readLine();
x++;
}
}
Any help to get me onto the right track? :confused:
Thanks