Reading from a text file

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

    Reading from a text file




    How can i just parse out the Indicator Readings in a text file so that
    i can fill an arraylist with the indicator values

    -------------------Indicator Test RAW BIT Values-------------------
    Date:09/12/2008
    Time:3:20 PM
    Username:Colin
    Serial Number:0
    Version:Empty
    Model:5335
    Manufactor:LMI


    Stage Location Indicator Reading
    0 366
    0.01 367
    0.02 371
    0.03 376
    0.04 379
    0.05 383
    0.06 386
    0.07 390
    0.08 393
    0.09 395
    0.1 398
    0.11 401
  • James Hahn

    #2
    Re: Reading from a text file

    It depends on the characters separating the stage from the reading, but it
    seems to me that the distinctive feature is the length of the line and that
    the trimmed left half and the trimmed right half are both numeric.

    "cmdolcet69 " <colin_dolcetti @hotmail.comwro te in message
    news:d2956f0b-25de-4a00-afc8-28da868c7f97@m4 5g2000hsb.googl egroups.com...
    >
    >
    >
    How can i just parse out the Indicator Readings in a text file so that
    i can fill an arraylist with the indicator values
    >
    -------------------Indicator Test RAW BIT Values-------------------
    Date:09/12/2008
    Time:3:20 PM
    Username:Colin
    Serial Number:0
    Version:Empty
    Model:5335
    Manufactor:LMI
    >
    >
    Stage Location Indicator Reading
    0 366
    0.01 367
    0.02 371
    0.03 376
    0.04 379
    0.05 383
    0.06 386
    0.07 390
    0.08 393
    0.09 395
    0.1 398
    0.11 401

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Reading from a text file

      "cmdolcet69 " <colin_dolcetti @hotmail.comsch rieb:
      How can i just parse out the Indicator Readings in a text file so that
      i can fill an arraylist with the indicator values
      You can use 'System.IO.Stre amReader' for this purpose. Just call the
      'ReadLine' method until you reach the indicator values (depending on the
      file format this may be necessary exactly n times). Then you can read the
      values line-by-line and split each line into its parts, which can be added
      to the array list. Make sure you check out the 'Trim' and 'Split'
      functions.

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

      Comment

      Working...