I have a text file and contain text below:
Contact Name | Contact Number
Muhammad Hassan Ali Khan| 123456
Danish Abdul Ghani | 165484
Adeel Siddiqui | 865697
Muhammad Faisal Bilal | 569745
Arslan | 145236
and I want to dispaly it as it is in the gridview and i am using the following code: for checking that i am right working for getting text from a file.
protected void Page_Load(object sender, EventArgs e)
{
string line = "";
StreamReader reader = new StreamReader("c:\\Contacts.txt");
while ((line = reader.ReadLine()) != null)
{
string[] arr = line.Split('\t\t|\t\t');
}
}
But at this line "string[] arr = line.Split('\t\t|\t\t');" error occur:
Error: Too many characters in character literal
How to remove this error. Kindly suggest me. waiting for reply. Thanks
Split('') indicates a type ofChar`, which can only hold a single character.