CSV::Parser

class CSV::Parser

Overview

A CSV parser. It lets you consume a CSV row by row.

Most of the time CSV#parse and CSV#each_row are more convenient.

Defined in:

csv/parser.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.new(string_or_io : String | IO, separator : Char = DEFAULT_SEPARATOR, quote_char : Char = DEFAULT_QUOTE_CHAR)Source

Creates a parser from a String or IO. Optionally takes the optional separator and quote_char arguments for specifying non-standard cell separators and quote characters

Instance Method Detail

def each_row(&block) : NilSource

Yields each of the remaining rows as an Array(String).

def each_rowSource

Returns an Iterator of Array(String) for the remaining rows.

def next_row(array : Array(String)) : Array(String)?Source

Reads the next row into the given array. Returns that same array, if a row was found, or nil.

def next_row : Array(String)?Source

Returns the next row in the CSV, if any, or nil.

def parse : Array(Array(String))Source

Returns the remaining rows.

def rewindSource

Rewinds this parser to the first row.

© 2012–2017 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.22.0/CSV/Parser.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部