This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Swing and Properties file  RSS feed

 
Aggarwal Arpit
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can anybody explain what this code is doing?
 
Tim Moores
Saloon Keeper
Posts: 3511
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting; does the post serve a particular purpose?
 
Aggarwal Arpit
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.....I just want to get meaning of this code
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags next time. It makes it easier to read your code.

It appears that this code replaces lines of a file that contain a specific sub string. Because modifying files on the fly is very tricky it uses an intermediate temporary file to write to first, which then overwrites the original file.
 
Aggarwal Arpit
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help Rob,
Can you explain while loop once more?..........Why we are checking the indexOf(stringToCheck)?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Why we are checking the indexOf(stringToCheck)?

did you read the apidocs for String to see what is returned?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!