• Post Reply Bookmark Topic Watch Topic
  • New Topic

decrementing position in a file based on variable  RSS feed

 
harrell collins
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I read a file, test the contents to a variable in a while loop and if the contents differ. decrement the lines of the file to another variable and write a line of text on the line directly above the variable. e.g.


for(String line; (line = lrdr.readLine()) != null {
System.out.println(lrdr.getLineNumber() + ":\t" + line);
if(br.readLine().startsWith("0TRADER:") == true){
prevTrader = br.readLine().substring(19,22);
if(br.readLine().startsWith("1")){ onelineNo = lrdr.getLineNumber(); if(br.readLine().startsWith("0TRADER:") == true){ curTrader = br.readLine().substring(19,22); if(curTrader.compareTo(prevTrader) != 0){ --onelineNo; System.out.println("$DJDE FORMS=PARIB6 FORMAT=PARCIX DUPLEX=NO FEED=BLUE SIDE=(NUFRONT,NOFFSET) MODIFY=NONE END;");
[ October 27, 2006: Message edited by: Jim Yingst ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Harrell, I've taken the unusual step of removing the [ code ] tags from your post. The reason being, your post had no line breaks and was far too wide to read comfortably. Unfortunately this would also force all other posts on this page to be just as wide, so it's not something we can just ignore. Normally I would just fix the formatting a little bit, but in this case there were too many typos; I couldn't tell what you were really trying to do. Please edit your post to include some sort of readable formatting, and then put in the [ code ] tags again. Thanks.
[ October 27, 2006: Message edited by: Jim Yingst ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!