{"id":21763643,"url":"https://github.com/eduherminio/fileparser","last_synced_at":"2025-10-24T19:31:25.031Z","repository":{"id":29824353,"uuid":"120954470","full_name":"eduherminio/FileParser","owner":"eduherminio","description":"C# file parser (.NET 6)","archived":false,"fork":false,"pushed_at":"2024-04-12T09:56:45.000Z","size":262,"stargazers_count":8,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-12T15:42:34.298Z","etag":null,"topics":["fileparser","net","net-6","net-8","text-parser"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eduherminio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-02-09T20:52:27.000Z","updated_at":"2024-04-14T18:44:25.118Z","dependencies_parsed_at":"2023-01-17T01:00:42.540Z","dependency_job_id":"e1851153-9fec-4d78-bcd4-cd0d79fd1df0","html_url":"https://github.com/eduherminio/FileParser","commit_stats":{"total_commits":191,"total_committers":10,"mean_commits":19.1,"dds":0.6544502617801047,"last_synced_commit":"12e835d93a942140f1a8533355c2cad663d63862"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduherminio%2FFileParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduherminio%2FFileParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduherminio%2FFileParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduherminio%2FFileParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eduherminio","download_url":"https://codeload.github.com/eduherminio/FileParser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724380,"owners_count":21151557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fileparser","net","net-6","net-8","text-parser"],"created_at":"2024-11-26T12:15:54.848Z","updated_at":"2025-10-24T19:31:19.992Z","avatar_url":"https://github.com/eduherminio.png","language":"C#","readme":"# FileParser\n\n[![Azure DevOps][azuredevopslogo]][azuredevopslink]\n[![GitHub Actions][githubactionslogo]][githubactionslink]\n[![Circle CI][circlecilogo]][circlecilink]\n\n[![Sonar Quality][sonarqualitylogo]][sonarqubelink]\n[![Code coverage][sonarcoveragelogo]][sonarqubelink]\n[![Sonar vulnerabilities][sonarvulnerabilitieslogo]][sonarqubelink]\n[![Sonar bugs][sonarbugslogo]][sonarqubelink]\n[![Sonar code smells][sonarcodesmellslogo]][sonarqubelink]\n\n[![Nuget][nugetlogo]][nugetlink]\n\n[![API][apimundologo]][apimundolink]\n\n**FileParser** is a **.NET** library designed to read text files line-by-line, saving each line's content into basic types vars (int, double, string, etc.).\n\n- .NET Framework 4.6 was supported until v1.4.x.\n- .NET Standard 2.0 and 2.1 were supported until v1.6.x.\n- `Nullable` is enabled from 1.6.x.\n\n## Purpose\n\nThis project was born with a very specific purpose: providing a tool with whom easily parse files with a known structure, ideally being as flexible and easy to use as C++ standard IO approach.\n\nFor those who don't understand what I mean, here's a simple Use Case ([also reposited](https://github.com/eduherminio/FileParser/tree/main/Examples)):\n\nGiven the following `input.txt`, which contains an integer n (\u003e=0) followed by n doubles and a final string,\n\n```txt\n5   1.1 3.14159265 2.2265       5.5 10              fish\n```\n\nA simple `.cpp` snippet like the following one could process `input.txt`, providing that file is selected as standard input source:\n\n`./myExecutable \u003c input.txt \u003e output.txt`\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003clist\u003e\n#include \u003cstring\u003e\n\nint main()\n{\n    int _integer;\n    std::string _str;\n    std::list\u003cdouble\u003e _list;\n    double _auxdouble;\n\n    // Input start;\n    std::cin\u003e\u003e_integer;\n    for(int i=0; i\u003c_integer; ++i)\n    {\n        std::cin\u003e\u003e_auxdouble;\n        _list.push_back(_auxdouble);\n    }\n    std::cin\u003e\u003e_str;\n    // Input end\n\n    // Data processing\n\n    // Output start\n    std::cout\u003c\u003c_integer\u003c\u003c\" \";\n    for(const double\u0026 d : _list)\n        std::cout\u003c\u003cd\u003c\u003c\" \";\n    std::cout\u003c\u003c_str;\n    // Output end\n\n    return 0;\n}\n```\n\nSeems effortless to process these kind of simple `.txt` files using C++, right?\n\nWell, using C# things are not so straight-forward, and that's why `FileParser` was created for:\n\n```csharp\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nusing FileParser;\n\nnamespace FileParserSample\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            var cultureInfo = new CultureInfo(\"en-US\");\n            CultureInfo.DefaultThreadCurrentCulture = cultureInfo;\n\n            List\u003cdouble\u003e listDouble = new List\u003cdouble\u003e();\n            string str;\n\n            // Input start\n            IParsedFile file = new ParsedFile(\"SimpleInput.txt\");\n            IParsedLine firstLine = file.NextLine();\n\n            int _integer = firstLine.NextElement\u003cint\u003e();\n\n            for(int i=0; i\u003c_integer; ++i)\n                listDouble.Add(firstLine.NextElement\u003cdouble\u003e());\n\n            str = firstLine.NextElement\u003cstring\u003e();\n            // Input end\n\n            // Data Processing\n\n            // Output start\n            StreamWriter writer = new StreamWriter(\"..\\\\CSharpSimpleOutput.txt\");\n            using (writer)\n            {\n                writer.WriteLine(_integer + \" \" + string.Join(null, listDouble));\n            }\n            // Output end\n        }\n    }\n}\n```\n\n## Documentation\n\nI've done my best to create a [WIKI](https://github.com/eduherminio/FileParser/wiki) describing FileParser API.\n\nBesides the WIKI, some real (own) projects where it has been used are:\n\n- [Google #HashCode 2018](https://github.com/eduherminio/Google_HashCode_2018/blob/master/GoogleHashCode2018/Project/Manager.cs#L63).\n- [Google #HashCode 2020](https://github.com/eduherminio/Google_HashCode_2020/blob/master/GoogleHashCode/BookManager.cs#L167).\n- [Advent of Code 2018](https://github.com/eduherminio/advent-of-code-2018).\n- [Advent of Code 2023](https://github.com/eduherminio/AoC2023).\n\n## Contributing, issues, suggestions, doubts\n\nIf anyone else ever happens to use FileParser, I'll be happy to accept suggestions and solve any doubts.\n\nJust open an issue :)\n\n[githubactionslogo]: https://github.com/eduherminio/FileParser/actions/workflows/ci.yml/badge.svg\n[githubactionslink]: https://github.com/eduherminio/FileParser/actions/workflows/ci.yml\n[azuredevopslogo]: https://dev.azure.com/eduherminio/FileParser/_apis/build/status/eduherminio.FileParser?branchName=main\n[azuredevopslink]: https://dev.azure.com/eduherminio/FileParser/_build/latest?definitionId=1\u0026branchName=main\n[circlecilogo]: https://circleci.com/gh/eduherminio/FileParser/tree/main.svg?style=svg\n[circlecilink]: https://circleci.com/gh/eduherminio/FileParser/tree/main\n[nugetlogo]: https://img.shields.io/nuget/v/FileParser.svg?style=flat-square\u0026label=nuget\n[nugetlink]: https://www.nuget.org/packages/FileParser\n[apimundologo]: https://img.shields.io/badge/FileParser%20API-Apimundo-728199.svg\n[apimundolink]: https://apimundo.com/organizations/nuget-org/nuget-feeds/public/packages/FileParser/versions/latest?tab=types\n[sonarqubelink]: https://sonarcloud.io/dashboard?id=eduherminio_FileParser\n[sonarqualitylogo]: https://sonarcloud.io/api/project_badges/measure?project=eduherminio_FileParser\u0026metric=alert_status\n[sonarcoveragelogo]: https://sonarcloud.io/api/project_badges/measure?project=eduherminio_FileParser\u0026metric=coverage\n[sonarvulnerabilitieslogo]: https://sonarcloud.io/api/project_badges/measure?project=eduherminio_FileParser\u0026metric=vulnerabilities\n[sonarbugslogo]: https://sonarcloud.io/api/project_badges/measure?project=eduherminio_FileParser\u0026metric=bugs\n[sonarcodesmellslogo]: https://sonarcloud.io/api/project_badges/measure?project=eduherminio_FileParser\u0026metric=code_smells","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduherminio%2Ffileparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feduherminio%2Ffileparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduherminio%2Ffileparser/lists"}