I have a project I'm working on to read a simple text file and sort it's contents based on the data.
The data file is in the following format:
Bob Smith: Accounting
John Doe : IT
Bill Morris:Maintena nce
etc...
My goal is to be able to sort each string by name OR by department.
So far, I have been able to read the file and sort by name (since name is the first item on each line of the file), but I can't seem be able to figure out how to reverse the contents of each line such as turning:
Bob Smith : Accounting
into:
Accounting: Bob Smith
I'm currently using a single 2-d array to store the contents of the file.
The data file is in the following format:
Bob Smith: Accounting
John Doe : IT
Bill Morris:Maintena nce
etc...
My goal is to be able to sort each string by name OR by department.
So far, I have been able to read the file and sort by name (since name is the first item on each line of the file), but I can't seem be able to figure out how to reverse the contents of each line such as turning:
Bob Smith : Accounting
into:
Accounting: Bob Smith
I'm currently using a single 2-d array to store the contents of the file.
Comment