gsv

Types

Option for using “\n = LF = Unix” or “\r\n = CRLF = Windows” line endings. Use with the from_lists function when writing to a csv string.

pub type LineEnding {
  Windows
  Unix
}

Constructors

  • Windows
  • Unix

Functions

pub fn from_lists(input: List(List(String)), separator separator: String, line_ending line_ending: LineEnding) -> String

Takes a list of lists of strings and writes it to a csv string. Will automatically escape strings that contain double quotes or line endings with double quotes (in csv, double quotes get escaped by doing a double doublequote) The string he"llo\n becomes "he""llo\n"

pub fn to_lists(input: String) -> Result(List(List(String)), Nil)

Parses a csv string to a list of lists of strings. Automatically handles Windows and Unix line endings.

Search Document