changing the format of an item list..

hi, im implenting a different loading system for items in my project, i want to convert my old file format to the new one, without manually going through over 8000 items…

i was thinking of writing some kind of convertor, to dump it into new format, but have no idea to do so.

heres the new format:

old format:


item = 0	Dwarf_remains	The_body_of_a_Dwarf_savaged_by_Goblins.	1	1	1	0	0	0	0	0	0	0	0	0	0	0	0

Have you attempted anything? What problems did you have when trying to do this?

Use a Scanner and put it into an arrayList of strings for easy saving to a file.

Scanner scan = new Scanner(your_old_file);
scan.useDelimiter(" "); //split with spaces

int index = 0; //keep count of current token number
List<String> newFile = new ArrayList<String>();
while (scan.hasNext())
{
      String token = scan.next();
      if (index == 0)
      {
           newFile.add("[ITEM]");
           newFile.add(...);
      }
      else
      //check all other ones here
      {
            
      }
       
      index++;
}


for (String s: newFile)
{
 //save the strings to the new file, each string on a new line.

}
  1. load old file format
  2. convert old data to internal data structure
  3. covert internal data structure to new data
  4. save data to new file format

when your new format has some more, less or different field you might have to derive some fields