N
needin4mation
Hi, I am trying to parse a colon delimited text file.
Assume these as examples:
Book:mybook
Video:myvideo
Name:myname
When I use this:
ReadFromFile("c:\\Inetpub\\wwwroot\\myfile.txt");
}
public void ReadFromFile(string filename)
{
StreamReader SR;
string S;
string[] myStr;
SR=File.OpenText(filename);
S=SR.ReadLine();
while(S!=null)
{
myStr = S.Split(new char[] { ':' });
Response.Write(myStr[0] + "<BR>");
S=SR.ReadLine();
}
SR.Close();
}
On my web page I get this:
Book
Video
What I am trying to get is the stuff on the other side of the colon.
How can I get either the data on the other side of the colon or just
the entire line?
Thank you for any help.
Assume these as examples:
Book:mybook
Video:myvideo
Name:myname
When I use this:
ReadFromFile("c:\\Inetpub\\wwwroot\\myfile.txt");
}
public void ReadFromFile(string filename)
{
StreamReader SR;
string S;
string[] myStr;
SR=File.OpenText(filename);
S=SR.ReadLine();
while(S!=null)
{
myStr = S.Split(new char[] { ':' });
Response.Write(myStr[0] + "<BR>");
S=SR.ReadLine();
}
SR.Close();
}
On my web page I get this:
Book
Video
What I am trying to get is the stuff on the other side of the colon.
How can I get either the data on the other side of the colon or just
the entire line?
Thank you for any help.