I do contract work for a living, which could include writing a program such as this. However, I don’t do people’s homework for them. That just robs them of an education.
You have my full permission to implement this project any way you please.
The only thing tricky about this is handling comments. Does a comment belong with the parameter/section above or below? If there is a blank line separating it from one but not the other, the answer in obvious. If the comment is the first or last line of the file, again the answer is obvious. If you can’t resolve what to do with the comment you can handle the ambiguity in one of four configurable ways:
You could do the sorting and merging of duplicates in at least three ways:
Once you have that working, you can then create variants on a theme. Merge a small ini file of changes into a big one. Setting a parameter to nothing deletes the parameter. A section with no entries is deleted.
Compare two messy ini files and display the essential differences by creating a tidied, comment-less version of both and comparing the parse trees in RAM.
Get your friends to donate a variety of real-life messy INI files, the dirtier the better, for you to test your program on.
Once you have that working, create this variant. You create a template example ini file that contains all the currently legal sections and fields. You use that model to clean out a messy INI file that is full of junk fields left over from previous versions of the program.
I have implemented this project myself and you can dhowload my source code.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.18] | The information on this page is for non-military use only. | ||
| You are visitor number 4,113. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/project/inifiletidier.html | J:\mindprod\project\inifiletidier.html | ||