printing from an array
if (tempWord.startsWith("'''Loc"))
basically i have code here that prints out the line from an array that starts with loc....
i need to keep printing though. Is there a way i could just start printing from the array when it finds the keyword loc, and print til the end of the array.
eg of text file:
the boy said yes
located the word
then went home
to bed
so here i would start printing at the word location until the end of the array.('bed')
[502 byte] By [
trasa] at [2007-11-26 20:30:11]

Use a for loop with the index declared outside the loop. That way you can access how far into the loop you got when you found "loc". Loop over the array until you find it, then break out of the loop. Start another loop, beginning with the line you ended the other loop with, printing each line until you reach the end of the array.
How would you do this manually?
You would keep track of whether you've already seen "loc", and print the item if you had.
pseudo-code:
alreadySawLoc = false
for each item in collection
if item starts with "loc"
alreadySawLoc = true
end if
if alreadySawLoc
print item
end for
How about a little method that prints an array starting at element 'loc':public void print(String[] array, int loc) {
for (; loc < array.length; loc++)
System.out.println(array[loc]);
}
kind regards,
Jos