I was given a text file where I need to separate the each email ids from the grouped text.
Each email ids were identified by the character comma(,) delimeter.
My solution resides in single line of code thats GetString method of ASCII class.
You can find this in System.Text namespace.
FileStream fs = new FileStream(“E:\\SLGroupFriends.txt”, FileMode.Open);
byte[] p = new byte[fs.Length];
fs.Read(p, 0, p.Length);
string r = Encoding.ASCII.GetString(p);
string[] result = r.Split(‘,’);
GridView1.DataSource = result;
GridView1.DataBind();
Tags: FileStream, comma delimeter split function in C#, Encoding.ASCII.GetString, System.Text, Convert byte to string array in C#