您可以使用简单的文件阅读器来完成此操作。您的文件由空格分隔;根据您的示例,每一行都以换行符结尾。
因此,您只需要做一些算术来计算索引,因为您在每行的第三部分中有价格、邮政编码和日期信息。
public static void main(String...args) throws IOException {
final File file = new File("/home/william/test.txt");
final String delimiter = " ";
final int dateStrLen = 10;
final int postCodeLen = 6;
BufferedReader br = new BufferedReader(new FileReader(file));
String tmp;
while ((tmp = br.readLine()) != null) {
String[] values = tmp.split(delimiter);
String name = values[0];
String city = values[1];
int dateStartPos = values[2].length() - dateStrLen;
int postCodeStartPos = dateStartPos - postCodeLen;
String date = values[2].substring(dateStartPos);
String postCode = values[2].substring(postCodeStartPos, dateStartPos);
String price = values[2].substring(0, postCodeStartPos);
// do something with the data
// you could store it with a dto or in arrays, one for each "column"
System.out.println(String.format("name: %s; city: %s; price: %s; post-code: %s; date: %s", name, city, price, postCode, date));
}
}