Reputation: 123
This is my data to input, where @ is used as a delimiter for different months of purchase oders.
14/06/13#PSE-3478#bT/4674#1
22/06/13#EMI-6329#LR/4992#8@
08/07/13#ESE-6329#bT/4674#15
09/07/13#PNE-3456#PV/5732#2
27/07/13#EMI-6329#PA/1234#4@
I know how to deal with a single line: .scanNextLine() as a String, and then apply scanner again having that String object as an argument, but with a different delimiter to extract other information.
But what if there are several lines to collect for each month? Will it be mixed up if I will put them to the same String object? Cause they have to remain separated in the lines as they are.
The thing is that I need to apply a method .startNewMonth() after the month has finished. Any suggestions how to implement it properly?
Many thanks.
Upvotes: 0
Views: 37
Reputation: 51445
You don't even need the at sign flag. You could check if the dates are in the same month.
Here's what you do in psudeocode:
for each line
process line
if line ends with @
start new month
end if
end for
Upvotes: 1