Hi,
I'm pretty new to c#. Can somebody please give me the right direction on how can I parse the following text file?
The program I am trying to implement will do the following:
It will ask the user to enter a directory. It will search the directory for text files. It will loop through the text files, parse them, and save them in a one table database. The text files have the following structure:
(This is text file 1)
001 - Milan (Citizens)
Pitch Street
  John Doe               15, F1 2             35022I        
  Janette Doe            17, F7 2             32345I            
Angel Street
  Mark Skate             12, F3 2             35532I        
  Jacqueline Skate       18, F6 2             54343I
(This is text file 2)
002 - Rome (Citizens)
Colosseum Street
  Christian Troy         21, F8 5             21354I        
  Janette Doe            17, F7 2             23453T            
Pope Street
  Sean McNamara          Villa McNamara       12424I        
  Julia McNamara         Villa McNamara       43344I
etc...
001 - Milan etc... is the town. This is found once at the beginning of every text file. Colosseum Street etc... is the street name. Then for every street there is a list with 3 columns: name, address, id card.
What I need is to insert every citizen into a database. the database will have one table with the following format:
name, surname, address, id_card, town, street
Therefore, every citizen must be stored in some kind of an array and the array will contain the citizen's respective town and citizen.
If somebody can give me some ideas on how to parse the format of this text file it would be great, since it has a bit of an unusual format. Also please note that the spaces between name, address and id card are actual spaces and not tabs.
Many thanks in advance!
Regards, Chris