method
parse_row
v1_8_7_330 -
Show latest stable
-
0 notes -
Class: CSV
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
parse_row(src, idx, out_dev, fs = nil, rs = nil)
public
Parse a line from string. Consider using CSV.parse_line instead. To parse lines in CSV string, see EXAMPLE below.
EXAMPLE
src = "a,b\r\nc,d\r\ne,f" idx = 0 begin parsed = [] parsed_cells, idx = CSV.parse_row(src, idx, parsed) puts "Parsed #{ parsed_cells } cells." p parsed end while parsed_cells > 0
ARGS
src: a CSV data to be parsed. Must respond '[](idx)'. src[](idx) must return a char. (Not a string such as 'a', but 97). src[](idx_out_of_bounds) must return nil. A String satisfies this requirement. idx: index of parsing location of 'src'. 0 origin. out_dev: buffer for parsed cells. Must respond '<<(aString)'. col_sep: Column separator. ?, by default. If you want to separate fields with semicolon, give ?; here. row_sep: Row separator. nil by default. nil means "\r\n or \n". If you want to separate records with \r, give ?\r here.
RETURNS
parsed_cells: num of parsed cells. idx: index of next parsing location of 'src'.