开发者

Parsing a text file

guys. I have a task and would like to hear your advice on implementation details.

I have a file which contains information about clients and their accounts.

FIRST_NAME=Joe

LAST_NAME=Bishop

RECEIPT.0.ID=123

RECEIPT.0.CURRENCY=USD

RECEIPT.1.ID=3654

RECEIPT.1.CURRENCY=EUR

.......................

CARD.0.TYPE=VISA

..........开发者_JAVA技巧.............

FIRST_NAME=Peter

LAST_NAME=Swalsky

...............

And so on. So I need parse this information into classes like Account etc. Shall I use Scanner class with certain match pattern and parse information step by step or there might be another elegant way to do that? Thank you so much in advance.


This looks like a valid Properties file, so java.util.Properties might help. It can load those files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜