Back to problems

Parse a Comma-Separated String with Quoted Fields

Algorithm · Upstart · Medium

Problem Description Implement a simplified CSV parser that converts a comma-separated string into a list of fields. The parser must obey the following rules: Fields are separated by commas (,). A field may be enclosed in either single quotes (') or double quotes ("). While inside a quoted field, commas are treated as ordinary characters, not as field separators. The enclosing quotes themselves are not part of the field value – they are removed from the output. Inside a…

Checking your access…