sonalake / utah-parser

Java library for parsing semi-structured text files
Apache License 2.0
64 stars 33 forks source link

Trimming of values differently implemented in JSON versus CSV export #28

Open sgoeschl opened 2 years ago

sgoeschl commented 2 years ago

I'm working with fixed-with column and some of the values are variable-length strings (also having spaces) and they could be left or right-aligned.

In theory it is possible to come up with a regex trimming the unwanted spaces but in reality it is hard since the regexp becomes hard to maintain (and I have many of them)

Depending on the output format

Would it make sense to trim the value in general? Our should/could this be a setting (global, field level)?

daniel-bray-sonalake commented 2 years ago

Would it make sense to trim the value in general?

We had thought of this, but were a little cagey about second-guessing the config files. So we chose to always trust the regex.

This seems like a very specific use case; can you explain what kind of config you're thinking of?

sgoeschl commented 2 years ago

Actually not thinking of anything - asking for your feedback :)

In my case I am generating CSV or HTML (based on the CSV) using FreeMarker templates

daniel-bray-sonalake commented 2 years ago

Let us ponder this one a little