aspose file tools*
The moose likes Beginning Java and the fly likes for loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "for loop" Watch "for loop" New topic
Author

for loop

tim hunt
Greenhorn

Joined: Apr 19, 2001
Posts: 9
Hi all,
Here I go. I'm running a method which uses a for loop to run through a StringBuffer until a criteria is matched. The loop then continues until the criteria is matched again. At this point the data is manipulated. Now when my method is called again the loop starts from zero again, ie endless loop. Is there anyway I can get the loop to start where it finished once the method is called again.
Thanks guys and girls
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5018
    
    8

Tim, It would be a lot easier to answer your question if you gave us some code to look at.


Junilu - [How to Ask Questions] [How to Answer Questions]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
In your for loop initialization where you normally say "int i=0;"
instead you say
int x = 0;
for (int i = x; etc)
then you control the value of the x so that the next time is starts at something other than 0.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: for loop