Java delimiter reader

Posted by newbieprogrammer on Stack Overflow See other posts from Stack Overflow or by newbieprogrammer
Published on 2012-11-13T15:36:52Z Indexed on 2012/11/13 23:00 UTC
Read the original article Hit count: 319

Filed under:
|

I have a colon-delimited text file containing grouped, related data. The People group contains people's names followed by their ages, separated by colons. How can I parse the text and group people according to their ages?

The structure is as follows:

Group.txt
Age:10:20:30:40:
Group:G1:10:G2:30:G3:20:G4:40:
People:Jack:10:Tom:30:Dick:20:Harry:10:Paul:10:Peter:20:
People:Mary:20:Lance:10:

And I want to display something like this:

G1 Jack Harry Paul Lance
G2 Dick Peter Marry
G3 Tom
G4

© Stack Overflow or respective owner

Related posts about java

Related posts about delimiter