4 kyu

Complex CSV Parser

890 of 930OverZealous
Description
Loading description...
Strings
Algorithms
  • Please sign in or sign up to leave a comment.
  • trashy_incel Avatar

    suggested edge cases that a first version of my code did not handle correctly, but passed anyways:

    • trailing empty column:
      • "1,2,,\n3,4" --> [ [ '1', '2', '', '' ], [ '3', '4' ] ]
      • "1,2,," --> [ ['1', '2', '', ''] ]
    • trailing empty row:
      • "a,b,c\n" --> [ ['a', 'b', 'c'], [''] ]
      • "\n\n\n" --> [ [''], [''], [''], [''] ]
  • FArekkusu Avatar

    You should check for unclosed quoted fields, and throw an error, but this is not tested here

    If you're not testing this, why is this mentioned in the description?

  • Xanthan Avatar

    Could someone convert this into python please?

  • ozichukwu Avatar

    The random tests does not cover all cases. See @steffan153 solution

  • SirSkylord Avatar

    Also if there is any way I could help on a translate let me know, I haven't ever made one before, but I could try to make a C++ one or even Python, just would need a little guidance to start.

  • SirSkylord Avatar

    Ah this kata is so underrated, definitely one of my favorite ones thus far! Thank OverZealous!

  • PowerPanda Avatar

    Nice kata, but please correct the spelling. "At it's simplest" should be "At its simplest".

  • dschnelldavis Avatar

    This comment has been hidden.

  • cherryvenus Avatar

    I don't know how to replace "/"

  • Wittybit Avatar

    Nice kata! Thx for it =)

  • darekl Avatar

    Well, I guess there are several bugs. The quota and test cases live in different dimensions than the requirements :-)

    BUG #1: According to the requirements the double quota at the end of the line should be end of quota not part of comment. BUG #2: Test scenario for BUG #1 is tested only after separator change. Error says it is problem with separator which is not true. BUG #3: According to the requirements you can report error about unclosed comments only at the end of input. (eg: ",,,,\n,,,,) BUG #4: Several times I had "Unknown error" - without any other info about it. BUG #5: This website not works with tools like uBlock :-) BUG #6: Looks like kata search not works at all. This kata cannot be found there. Also no JavaScript 1kyu, 2kyu or 3kyu in search?

    However, It was fun to solve it. Maybe I will do some other too if find some time :-)

  • Rambutan Avatar

    This comment has been hidden.

  • brianpck Avatar

    Awesome kata! Learned a lot about Regex.

  • joh_pot Avatar

    Nice kata. Super frustrating but only due to extensive test cases. Took me longer to complete than some 2kyu katas. Well done!

  • computerguy103 Avatar

    This comment has been hidden.

  • user578387 Avatar

    I would love to tackle this in Ruby...

  • xDranik Avatar

    Not sure why this test failed :/ Test Failed: Expected: [["1","two, too","3"],["4","5","6"]], instead got: [["1","two, too","3"],["4","5","6"]]

  • benzrf Avatar

    That was pretty fun, although a bit frustrating (mostly because I'm not super used to using CS). I ended up accidentally using Haskell-style function application twice and wasted 5-10 minutes trying to find the bug both times...

  • randm989 Avatar

    A really good test of using the regexp lookahead functionality, I never get a chance to use it as much as this asked for.

    I didn't use a single if or else to solve it :) Felt like a great problem

  • OverZealous Avatar

    Calling on jhoffner or other moderator to approve my kata... :-)

  • Zirgion Avatar

    It seems that the first test ("should handle an empty file") takes an inordinately long time to complete, my code times out every time when that test should give a success. If I return [[]] instead of [[""]] with an empty input string, it (and every other test) completes without a hitch.

    Not sure if this is a problem with the test or the test library.

  • OverZealous Avatar

    There's still a "minor issue" vote on this, but I haven't had any feedback in a while. Can this get moved up for moderator approval?

  • ssineriz Avatar

    Nice one! I'm only sorry I couldn't find an elegant way to solve it but the problem seems to require a high cyclomatic complexity (lots of if/then/else)

  • frenetic_be Avatar

    This was a great one ... enjoyed it a lot.

    I've had one problem though. I'm not sure where the problem is but I got an error message when trying to run the test fixture (unfortunately, i didn't write down the message but it was something like "cannot use the method 'push' on null"). originally, i thought it was in my code but i tested it and it was running fine. To make sure, i removed all "push" calls from my solution and ran it again. The error message still came up. In the end, I decided to delete your example of test fixture and wrote a simple one myself. this one ran without problems. So, I don't know where the problem is but it looks like it didn't like running your test fixture example.

    Nevertheless, it's a great kata. i'll mark it ready once you find out what the problem is.

  • OverZealous Avatar

    If there's nothing else wrong with this kata, it would be nice to have the remaining issue removed. :-) Otherwise, I'd be happy to tweak it.

  • JulianNicholls Avatar

    I enjoyed that one. We need more like this and less of the time bomb / prediction / none shall pass type.

  • jakber Avatar

    The given function template contains a headerRow parameter which shouldn't be there.

  • yoshimitsu Avatar

    this lacks examples in the description.