3 ms·
Hah! Yes. I recently did a coding test for a job where one of the tasks was to write a formatter for Dutch license plates. Typically these are in the format XX
by davedx 8y ago
Hah! Yes.
I recently did a coding test for a job where one of the tasks was to write a formatter for Dutch license plates. Typically these are in the format XX-99-YY, but there are... exceptions. At first glance it seems like it won't be too hard. But it ended up sucking up something like half of the whole coding test time.
I did beat it, with a lot of help from unit tests, but formatting is indeed a tougher problem than you'd expect.
- Someone 8y agohttps://en.wikipedia.org/wiki/Vehicle_registration_plates_of_the_Netherlands#Current_series https://en.wikipedia.org/wiki/Vehicle_registration_plates_of... is complex, indeed, but I don’t see how formatting would be difficult. How do they store those, other than as the formatted string? Parsing/validity checking, on the other hand, could be cumbersome.
- teraflop 8y agoI'm assuming "formatting" means "inserting hyphens in the correct place". Based on the examples in that Wikipedia page, it looks like the correct rule is to insert a hyphen between a letter and a digit that are adjacent, or in the middle of a group of 4 letters or 4 digits. But maybe there are other edge cases where that fails.