I use Scanner and Delimiter to tokenize my .txt file (this is the homework I need to do). The first version of the file is as follows:
5,5,5,6,5,8,9,5,6,8, good, very good, excellent, good
7,7,8,7,6,7,8,8,9,7,very good, Good, excellent, very good
8,7,6,7,8,7,5,6,8,7 ,GOOD, VERY GOOD, GOOD, AVERAGE
9,9,9,8,9,7,9,8,9,9 ,Excellent, very good, very good, excellent
7,8,8,7,8,7,8,9,6,8 ,very good, good, excellent, excellent
6,5,6,4,5,6,5,6,6,6 ,good, average, good, good
7,8,7,7,6,8,7,8,6,6 ,good, very good, good, very good
5,7,6,7,6,7,6,7,7,7 ,excellent, very good, very good, very good
And I used useDelimiter("[ ]*(,)[ ]*"), the second version of the file is as follows:
5 5 5 6 5 8 9 5 6 8 good, very good, excellent, good
7 7 8 7 6 7 8 8 9 7 very good, Good, excellent, very good
8 7 6 7 8 7 5 6 8 7 GOOD, VERY GOOD, GOOD, AVERAGE
9 9 9 8 9 7 9 8 9 9 Excellent, very good, very good, excellent
7 8 8 7 8 7 8 9 6 8 very good, good, excellent, excellent
6 5 6 4 5 6 5 6 6 6 good, average, good, good
7 8 7 7 6 8 7 8 6 6 good, very good, good, very good
5 7 6 7 6 7 6 7 7 7 excellent, very good, very good, very good
And I can’t come up with a regular expression that would help me separate the numbers with a space and words with a comma. Every month I need an array with 14 values (it’s very good that this is the only variable)
Please note that there are several gaps (this is done in order to make it more difficult for us).
Therefore, any help would be appreciated.
PS We are allowed to use only delimiters (no splits, etc.)