Đã Đóng

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

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"

begin

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

rescue ArgumentError => e

puts "ArgumentError: #{e}"

end

Kỹ năng: Thuật toán, Ruby, Kiểm tra phần mềm

Xem thêm: 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, web form write csv, write csv form, applications write csv file

Về Bên Thuê:
( 7 nhận xét ) Baltimore, United States

Mã Dự Án: #15232896

5 freelancer đang chào giá trung bình $87 cho công việc này

victor980410

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 trong 1 ngày
(2 Đánh Giá)
1.8
mrherkar

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 Thêm

$333 USD trong 25 ngày
(0 Đánh Giá)
0.0
pugachev

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 trong 1 ngày
(1 Đánh Giá)
0.0
$20 USD trong 1 ngày
(0 Đánh Giá)
0.0
nitzanfarhi

A proposal has not yet been provided

$15 USD trong 1 ngày
(0 Đánh Giá)
0.0