Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
In Germany - for excel compatibility - CSVs have a semicolon as an delimiter.
As a comma is a separator for digits - e.g. 3,14
CSV parsing requires knowledge of the delimiter (is it a comma or not xD), quotation and newline separator.
Otherwise... It's garbage -
@dotnethostage forbidding newlines inside of fields is a ridiculous constraint for a data file, though.
-
sariel84473yAnd here I am properly escaping my values to use in CSV generation.
Who knew it was so easy to just use something out of the box. /s -
C0D4669023yAll you have to do is escape and wrap all data.
Yes type checks get fucked in the ass, but fuck types when you have to deal with Excel as the software opening this shit. I'd rather a csv that opens and the data doesn't jump around cells then worry about if it's a string, if it's a number with a comma or a leading 0 🤷♂️
Everything just became a string! -
Looking at the regexes here and other stuff....
Most languages have an CSV im -/ export function for that reason.
And regexes are pretty much the worst approach to a tokenized string.
Just have a clear spec, rest is easy. -
@dotnethostage why not.... Just saying it like this?
;) I dunno, but when someone tries to impress me with regexes, I want to make him a sandwich, puff his cheeks and treat him like a lil preschooler xD
Or did I get the impression part wrong? XD -
@dotnethostage I think you misunderstood me.
I was a bit baffled by you trying to find a matching regex as a formal way to prove that your statement is correct. :)
I like regular expressions and I'm not feeling intimated at all.
It's just that the statement "It's a simple non-general recursive grammar" would have been sufficient, the extra effort of an regex seemed like you tried to gain some extra points like in a contest. -
@dotnethostage then apologize my rudeness and take this cookie as an peace offering :)
-
Just dropped by to say
I don't know about you guys, but I am intimidated by that regex, personally. -
sariel84473y@hardCoding I tell every dev the same thing that says that.
Regex will change your life. Start small, and pick one flavor of it(python, ruby, sed). Once you feel comfortable in one, the rest kinda fall into place.
After that it's easy to switch between pcre, posix, etc.
Related Rants
-
lorless9Whoever implemented the data import in Numbers on Mac needs to be lined up against a wall and shot with needle...
-
Wack7EXCEL YOU FUCKING PIECE OF SHIT! don't get me wrong, it's usefull and kt works, usually... Buckle up, your i f...
-
donkulator13A 520MB CSV file with 29 columns and no headers. If it's not an impertinent question, why in the name of Sa...
YOU CANNOT parse CSV by just splitting the string by commas.
YOU CANNOT generate CSV by just outputting the raw values separated by commas.
CSV is not the magical parseless data format. You need to read fields in quotations, and newlines inside of fields shouldn't prematurely end the row.
Do it fucking right holy shit.
rant
csv