The Weird and The Wonderful

The Weird and The Wonderful forum is a place to post Coding Horrors,
Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid
workarounds and developers just not quite getting it. And then somedays we come across - or write -
the truly sublime.

Post your Best, your worst, and your most interesting. But please - no
programming questions . This forum is purely for amusement and discussions on code snippets. All
actual programming questions will be removed.

I've been importing from text files, spreadsheets, etc. for over 18 years now. Just when you think you've seen it all a client brings you this:
Each line of a *.csv file starts and ends with double-quotes. Oh yes, we've had handling in place for many years to deal with embedded double-quotes in csv files (generally a sign of formatted numbers)...basically by stripping the formatting between pairs of double-quotes. It's worked great for many years until now...where it unfortunately removed all the commas leaving a big mess...not good! Of course, it's my fault!

It was an easy fix, but I'm still shaking my head over the fact that their programmer who wrote that export told me that he didn't know why it was getting formatted that way, and that it looked fine to him. (due to the fact that the double-quotes didn't show up in Excel...nevermind the fact that column A contained a comma-separated list of the items!)

I must be getting too old to argue, instantly agreed that it was my problem, fixed, tested, signed, sealed and delivered in < 30 minutes. Jpb security I guess!

I'd send this to my client, but it's already been 'fixed'. btw, I actually saw firsthand how the problematic file (each line is enclosed in double-quotes) is being generated...via a SSRS report having all the values in a single column.

But here, we take what we can get, which is why it became my problem...add function isTheWholeFrigginLineDoubleQuoted to set a Boolean PleaseRemoveTheFrigginDoubleQuotesOnlyAtTheBeginningAndEndOfThisLine which when true will perform the needed action. (who says you can't have self-documenting code!)

That was my guess as well. It could have been easily handled by the other programmer...he knew it was a problem, hence the phone call to me stating that my import isn't working properly with their new file format.

Nothing is more annoying than a "programmer" who can't program or do simple calculations. I would have done the same thing. Arguing with these 'dips' is like talking to a wall. Just fix the darn thing and move on.

Doesn't that simply import each row as a single field per row? Seems to me your code is working.

".45 ACP - because shooting twice is just silly" - JSOP, 2010-----You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010-----When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013