c# Analyse Data Stream

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bobido
    New Member
    • Feb 2008
    • 13

    #1

    c# Analyse Data Stream

    Hi There,

    I have a log file in ASCII that holds these lines of text:

    02-20-2008,10:18:47,4 .78,4.79,4.78

    Iam trying to load these in c# and use the data like date and time. So far i only managed to get the whole lines of text in my program. Is there a way to like dismantel the line of text from start to "," and so on.

    instead of:
    02-20-2008,10:18:47,4 .78,4.79,4.78

    this:
    Date: 02-20-2008
    Time: 10:18:47

    Many thanks in advanced =D
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    You could a do a .Split(','); on the line of string.
    That would return a string[], with an entry for set of characters in between the ,

    So in the case of
    Code:
    02-20-2008,10:18:47,4.78,4.79,4.78
    You would have:
    [code=text]
    02-20-2008
    10:18:47
    4.78
    4.79
    4.78
    [/code]

    Then you could DateTime.Parse( ) the first two values concatinated to get your date time.

    Comment

    • bobido
      New Member
      • Feb 2008
      • 13

      #3
      I managed to do so, thx! =D

      Comment

      Working...