GDX icon indicating copy to clipboard operation
GDX copied to clipboard

DataTable doesn't export correctly to CSV when the last field of the last row is empty

Open npinsker opened this issue 6 months ago • 1 comments

It breaks when loading the final row. https://github.com/dotBunny/GDX/blob/1f69a687fac6ceddca76935b53c9cffbcd87dd52/GDX/DataTables/DataBinding/Formats/CommaSeperatedValueFormat.cs#L154 calls TextGenerator.ToString() which calls String.Trim() which removes the final space in a CSV export. It's inconsistent with the other rows which all have trailing spaces.

This results in an error when loading: https://github.com/dotBunny/GDX/blob/1f69a687fac6ceddca76935b53c9cffbcd87dd52/GDX/DataTables/DataBinding/Formats/CommaSeperatedValueFormat.cs#L270 is always true for every line except the last, so returnStrings.Add(line.Substring(lastIndex + 1).Trim()); is skipped for the last line, making the last row array one cell shorter than it should be.

npinsker avatar Jun 06 '25 03:06 npinsker

@Humidibot wanna tackle this one? I'm Unity-less atm :( literally locked out of my account cause of the 2FA stuff that I never added :/

reapazor avatar Jul 14 '25 14:07 reapazor