Reading complex Data from a file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Blue man

    #1

    Reading complex Data from a file

    Hello
    I have a data file like this :
    01 "" "09:04" "PLMDX " 3.20 0.35 1.74 0.23 2.49 0.17
    1.37 0.18 03
    02 "" "09:05" "PLMDX " 3.70 0.18 1.93 0.14 2.75 0.19
    1.05 0.01 03
    03...
    04...
    ......
    and i want to read each number and fileds and save it to variables to save
    it in to the database .
    with stream reader and file rader i can only read all of it as a single
    string , is that possible to do it with regular expression ? i don't know
    how . any idea ...
    help please




  • Chad Myers

    #2
    Re: Reading complex Data from a file


    "Blue man" <famebluerain@y ahoo.co.uk> wrote in message
    news:e5DTMKwYDH A.2020@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hello
    > I have a data file like this :
    > 01 "" "09:04" "PLMDX " 3.20 0.35 1.74 0.23 2.49[/color]
    0.17[color=blue]
    > 1.37 0.18 03
    > 02 "" "09:05" "PLMDX " 3.70 0.18 1.93 0.14 2.75[/color]
    0.19[color=blue]
    > 1.05 0.01 03
    > 03...
    > 04...
    > .....
    > and i want to read each number and fileds and save it to variables to[/color]
    save[color=blue]
    > it in to the database .
    > with stream reader and file rader i can only read all of it as a[/color]
    single[color=blue]
    > string , is that possible to do it with regular expression ? i don't[/color]
    know[color=blue]
    > how . any idea ...
    > help please[/color]

    Can't you use the ReadLine() method of StreamReader? It looks like
    everything is on a row-by-row, line-by-line basis.

    Once you have a line, then you can use a Regex to split it.
    Unfortunately String.Split() won't work because of the quotes.

    -c



    Comment

    Working...