如何使用java从属性文件中仅取出某些记录

时间:2017-10-13 13:00:59

标签: java

我有一个 sample.properties 文件,其中包含以下详细信息:

Id = 212208386
Dept = INSTORE
Name = Hello Bye
itemsSold = 2.0

Id = 212208324
Dept = WEB
Name = Mr Perfect
itemsSold = 2.0
Misc = None

Id = 212899004
Dept = INSTORE
Name = AB CD EF
itemsSold = 2.0

Id = 213112314
Dept = INSTORE
Name = No Please
itemsSold = 2.0
Misc = Sale Offer

等等。

你能帮我一个读取这个文件的java代码,接受一个I​​d输入(Say,ID = 212208324)并给出相应的记录作为输出

我,如果我提供Id = 212208324和File = sample.properties,它应该提供以下输出:

Id = 212208324
Dept = WEB
Name = Mr Perfect
itemsSold = 2.0
Misc = None

0 个答案:

没有答案