]> gitweb.factorcode.org Git - factor.git/blob - basis/csv/csv-docs.factor
Append input history to ~/.factor-history upon UI Listener ending
[factor.git] / basis / csv / csv-docs.factor
1 USING: help.markup help.syntax io.pathnames quotations strings ;
2 IN: csv
3
4 HELP: read-row
5 { $values { "row" "an array of fields" } }
6 { $description "parses a row from a csv stream" } ;
7
8 HELP: read-csv
9 { $values { "rows" "an array of arrays of fields" } }
10 { $description "Parses a csv stream into an array of row arrays." } ;
11
12 HELP: file>csv
13 { $values
14     { "path" pathname } { "encoding" "an encoding descriptor" }
15     { "csv" "csv" }
16 }
17 { $description "Opens a file and parses it into a sequence of comma-separated-value fields." } ;
18
19 HELP: csv>file
20 { $values
21     { "rows" "a sequence of sequences of strings" }
22     { "path" pathname } { "encoding" "an encoding descriptor" }
23 }
24 { $description "Writes a comma-separated-value structure to a file." } ;
25
26 HELP: string>csv
27 { $values
28     { "string" string }
29     { "csv" "csv" }
30 }
31 { $description "Parses a string into a sequence of comma-separated-value fields." } ;
32
33 HELP: csv>string
34 { $values
35     { "csv" "csv" }
36     { "string" string }
37 }
38 { $description "Writes a comma-separated-value structure to a string." } ;
39
40 HELP: write-row
41 { $values { "row" "an array of fields" } }
42 { $description "writes a row to the output stream" } ;
43
44 HELP: write-csv
45 { $values { "rows" "a sequence of sequences of strings" } }
46 { $description "Writes a sequence of sequences of comma-separated-values to the output stream, escaping where necessary." } ;
47
48 HELP: with-delimiter
49 { $values { "ch" "field delimiter (e.g. CHAR: \\t)" }
50           { "quot" quotation } }
51 { $description "Sets the field delimiter for read-csv, read-row, write-csv, or write-row words." } ;
52
53 ARTICLE: "csv" "Comma-separated-values parsing and writing"
54 "The " { $vocab-link "csv" } " vocabulary can read and write CSV (comma-separated-value) files." $nl
55 "Working with CSV files:"
56 { $subsections file>csv csv>file }
57 "Working with CSV strings:"
58 { $subsections string>csv csv>string }
59 "Changing the delimiter from a comma:"
60 { $subsections with-delimiter }
61 "Reading from a stream:"
62 { $subsections read-csv read-row }
63 "Writing to a stream:"
64 { $subsections write-csv write-row } ;
65
66 ABOUT: "csv"