string str = @"    //Hello
                            //My Name is BBKing
                            //I am 61 years Old
                            //Goodbye
                            //L.A U.S.A
                            //2011-09-30 13:01:20";

         string[] str2=str.Split(new string[] {"//"},
StringSplitOptions.RemoveEmptyEntries);
         bool P=false;
         for (int i = 0; i < str2.Length; i++)
         {
             if (str2[i].ToLower().Trim() == "goodbye") P = false;
              if (P) Console.WriteLine(str2[i]);
             if (str2[i].ToLower().Trim() == "hello") P = true;
         }

On Mon, Oct 3, 2011 at 11:55 AM, Behrooz <[email protected]> wrote:

> Hello guys,
> I have a task which I have to read a text file and then find some part
> of the text file and then extract those parts to another program.
>
> More explanation:
> I have textFile.txt which contains :
>
> //Hello
> //My Name is BBKing
> //I am 61 years Old
> //Goodbye
> //L.A U.S.A
> //2011-09-30 13:01:20
>
> I am going to add this file to my C# project then I have to write a
> program to read the file then it can extract the lines between //Hello
> to //Goodbay.
>
> I am beginner in programming.
> I will appreciated if you help me to do this task!
>
> --
> You received this message because you are subscribed to the Google
> Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
> Web Services,.NET Remoting" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
> or visit the group website at http://megasolutions.net
>

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to