Write a CSV class

# Write a CSV parser that handles complex files without using the standard library.

# A standard CSV has fields separated by commas and rows separated by newlines. It may

# also have fields wrapped in quotes. Your CSV parser needs to handle quoted fields that

# may contain delimiter and newline characters.

# Spec (based on [url removed, login to view]):

# - The parser should return an array of arrays, one array for each row of the CSV file.

# - Rows are delimited by the newline character ("\n").

# - Each column is divided by a separator character (default ",").

# - Empty fields are valid.

# - Likewise, an empty row is still valid, and effectively contains a single empty field.

# - Uneven rows are valid.

# - A quoted field starts and ends with the same character (default '"'), and every

# character in between makes up the field value, including delimiters and newlines.

# - Quoted fields start immediately following a separator character, newline,

# or start of the file.

# - A quote character within a quoted field must be escaped by preceding it

# with another quote character.

# - Throw an error on unclosed quoted fields (or stray quotes inside fields).

# - Write tests that test your parser against the above spec.

# - Benchmark your solution.

class CSV

def [url removed, login to view](*); end


# Examples:

# Expected: [['a', 'b', 'c'], ['d', 'e', 'f']]

print [url removed, login to view]("a,b,c\nd,e,f"), "\n"

# Expected: [["one", "two wraps,\nonto \"two\" lines", "three"], ["4", "", "6"]]

print [url removed, login to view]("one,\"two wraps,\nonto \"\"two\"\" lines\",three\n4,,6"), "\n"

# Expected: [['alternate', '"quote"'], [''], ['character', 'hint: |']]

print [url removed, login to view]("|alternate|\t|\"quote\"|\n\n|character|\t|hint: |||", "\t", "|"), "\n"

# Expected: "Argument error: unclosed quote"


print [url removed, login to view]('"dog","cat","uhoh'), "\n"

rescue ArgumentError => e

puts "ArgumentError: #{e}"


Skills: Algorithm, Ruby, Software Testing

See more: csv reader java, python csv header, csv writer python, python read csv into array, python write csv example, python csv to dictionary, write list to csv python, csv.reader python 3, vbnet write csv, vbscript write csv, web form write csv file, webform write csv, read modify write csv file python, csv class vba, php form write csv, write csv mysql java, form write csv, write csv, excel vba write csv cvs, javascript write csv

About the Employer:
( 7 reviews ) Baltimore, United States

Project ID: #15232896

5 freelancers are bidding on average $87 for this job


Hello I can do it but my price is 50$. May be it's higher that you expected but task is a bit complex

$50 USD in 1 day
(2 Reviews)

hello, what programming language do you need? How you mean this: without using the standard library. Relevant Skills and Experience 30+ years programming and Excel, my own CSV Serializer, from C# class to CSV Propose More

$333 USD in 25 days
(0 Reviews)

Hello, I am new on the site, but I have wide experience in java development, and I can do what you need on java Relevant Skills and Experience 1 Proposed Milestones $100 USD - 1 e

$15 USD in 1 day
(1 Review)
$20 USD in 1 day
(0 Reviews)

A proposal has not yet been provided

$15 USD in 1 day
(0 Reviews)