CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2012
    Posts
    12

    Some find work input please

    Hello!

    What I'm doing
    ---------------

    I am reading a file one line at a time, when I hit the 16th line I split it and fill 3 arrays with values I want.
    I have gotten some really good help on that here, so thanks to all for that.


    Problem
    --------

    It turns out that all the files I'm reading are not the same, so the 16th line will not always have the information I want in it.


    Question
    ---------

    This is what the line looks like in the .txt file

    Code:
    "Mean",0,25.384,10.622,3205.72
    That is the first line to have the word "Mean" in it, I've checked. So instead of getting the 16th line I was thinking about just looping through
    until the hit the first line with "Mean" in it. I tried something like this (code below) but it didn't seem to work. Any suggestions would be great.
    I value your opinions

    Code:
    if (contains = Regex.IsMatch(line, @"\bmean\b"));
    Thanks for you help in this

    cheers!
    Stevish

  2. #2
    Join Date
    Oct 2012
    Posts
    18

    Re: Some find work input please

    Not sure what you mean but I think you could use :
    if (mystring.Contains("Mean")){...}
    and then parse it as CSV
    string[] columns = reader.ReadLine().Split(StrDelimiter.ToCharArray());

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured