Created
April 1, 2013 04:17
-
-
Save shahzore-qureshi/5283223 to your computer and use it in GitHub Desktop.
.NET File Parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string filePath = "C:\\Users\\Administrator\\Documents\\Visual Studio 2012\\Projects\\MvcApplication1\\MvcApplication1\\Content\\Uploads\\zipcodes.txt"; | |
| System.IO.StreamReader file = new System.IO.StreamReader(filePath); | |
| string line; | |
| string[][] strings = new string[40][]; | |
| char[] delimiters = new char[3]; | |
| delimiters[0] = '\"'; | |
| delimiters[1] = ','; | |
| delimiters[2] = '\n'; | |
| for (int i = 0; i < 40; i++) | |
| { | |
| line = file.ReadLine(); | |
| string[] tempArray = line.Split(delimiters); | |
| List<String> tempList = new List<string>(); | |
| for (int j = 0; j < tempArray.Length; j++) | |
| { | |
| if (tempArray[j] != "") | |
| { | |
| tempList.Add(tempArray[j]); | |
| } | |
| } | |
| strings[i] = tempList.ToArray(); | |
| } | |
| file.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment