如何将字段存储在文本文件中或映射中,然后将字段与Java中其他文本文件中的字段进行比较?
Text file1
2348384#Test 123####3983#Data 22 ....
等等,此File1具有许多字段,这些字段被“#”字符隔开,并且文件中有许多行。
Text file 2
23,809,Test 88, Dat 33
文件2的字段被逗号分开,并且有许多行。
我需要比较文件中的文件匹配中的字段2。在两个文件中,许多字段都是相同的,所以如果两者相同,我需要编写代码以匹配吗?
是否应该将所有字段存储在文件1中的字符串中[] []
说我要比较第4行,字段9,字符串[3]
,或者我应该将个人字段存储在字符串变量中。
如何在2个文本文件中比较字符串变量。爪哇?我应该将所有行存储在列表还是哈希图中的文件中?
谢谢。
Text file1
2348384#Test 123####3983#Data 22 ....
etc this file1 has many fields that are separted by "#" character and there are many rows in the file.
Text file 2
23,809,Test 88, Dat 33
File 2 has fields separated by comma and its has many rows.
I need to compare if fields from file match in file2. Many fields are same in the 2 files, so i need to write code to match if both are same?
Should i store all fields in file 1 into a String[]
Say i want to compare Row 4 ,field 9 , String[3]
or should i store individuals fields in a String variable..
How can i compare fields in 2 text files in java? SHould i store all lines in a file in a List or HashMap?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的意思是这样的吗?抱歉,如果这是混乱的代码
Do you mean something like this? Sorry if this is messy code