Flowdock
method

parse_row

Importance_2
Ruby latest stable (v1_9_3_392) - 0 notes - Class: CSV

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.

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'.
Show source
Register or log in to add new notes.