• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to parse a properties file with context markerrs

 
Ron Wheeler
Greenhorn
Posts: 9
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java supports Properties files and makes them easy to read.

Is there a way to easily parse a file that has properties grouped into contexts
[100]
user=Ron
city=Montreal
[101]
user=Mary
city=New York
[102]
user=Jacques
city=Paris

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That format looks like the format that is used in Windows *.ini files. Java's java.util.Properties class doesn't support this. So if you want to parse a file in that format, you'd have to write some code yourself for that.
 
Ron Wheeler
Greenhorn
Posts: 9
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

That was the nudge that I needed. Feel a bit stupid that I did not make the relation to the INI format.

A quick google got me
http://stackoverflow.com/questions/190629/what-is-the-easiest-way-to-parse-an-ini-file-in-java

which has a link to

http://ini4j.sourceforge.net/index.html

Looks like it will move me forward to the next blockage!

Ron
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic