Ok, so basically I have a text file that contains the following:
Resource10 "Insert Exhaust Valve"
Resource1 "6, 10, 18, 1"
Resource21 "Emergency Stop"
Resource2 "Cool Down in Progress"
I want to read the file line by line and store it in a vector (this is no problem). Next, I want to sort each line in the vector so that the lines are in order of resource number (i.e. Resource1 "6, 10, 18, 1", Resource2 "Cool Down in Progress", Resource3 ...., Resource 10...., Resource21....).
So, what I want to know is if there is a way of splitting each of the strings in the vector so that the resource number is separate from the command, from which i can sort the resource numbers by using sort and again by sorting by length (so 10 comes later than 2 and 3) and then putting the command back together with its original resource number?
Basically I want to ensure that the commands are always mapped to their specific resource number so i can manipulate the resource number as much as i want and still have the same command attached to it at the end.. I can't get my head round it, but would be thankful of any input from you guys.