CSV Parser with CC0 License.
Best for:
- Unity projects that requires cross-platform CSV parser. (maybe works on any platform supported by Unity)
- Commercial products that you could not display the license.
Environment | Prerequisites |
---|---|
Unity 2019.2 or later | None |
Unity 2019.1 or earlier | .NET 4.x Equivalent |
.NET Project | System.Memory from NuGet |
Download zip or unitypackage from Releases.
This returns CSV data as List<List<string>>
.
CSVParser.LoadFromString(string data)
or
CSVParser.LoadFromPath(string path, Encoding encoding = null)
var sheet = CSVParser.LoadFromString(csvString);
var styled = new StringBuilder();
foreach (var row in sheet)
{
styled.Append("| ");
foreach (var cell in row)
{
styled.Append(cell);
styled.Append(" | ");
}
styled.AppendLine();
}
Debug.Log(styled.ToString()); // Unity
Console.WriteLine(styled.ToString()); // C#
Compliant with RFC 4180.
- Correctly parse new lines, commas, quotation marks inside cell.
- Escaped double quotes.
- Some encoding types. (default UTF-8)
-
Tab delimiter support
-
Async loading
The repository contains multiple types of newline code. Run git config core.autocrlf false
in your local repository.
One of the reasons is to check operation in different Unity versions. Another one is to build .unitypackage with CI.
Unity changes a lot between their Tech Streams. It leads different requisites / dependency to the parser. Affected changes below.
Versions | Difference |
---|---|
2019.1 and 2019.2 | Has Scripting Runtime Version selector or not. |
2021.1 and 2021.2 | Requires additional DLLs or not. |
CC0 or Public Domain
Copyright (c) .NET Foundation and Contributors