Liking cljdoc? Tell your friends :D

clojurescript.csv Build Status Dependency Status

A ClojureScript library for reading and writing comma (and other) separated values.

Installation

Leiningen:

[testdouble/clojurescript.csv "0.8.0"]

Maven:

<dependency>
  <groupId>testdouble</groupId>
  <artifactId>clojurescript.csv</artifactId>
  <version>0.8.0</version>
</dependency>

Usage

(ns my.domain.core
  (:require [testdouble.cljs.csv :as csv]))

;; Basic usage
(csv/write-csv [[1 2 3] [4 5 6]])
;;=> "1,2,3\n4,5,6"

;; Define your own separator
(csv/write-csv [[1 2 3] [4 5 6]] :separator "|")
;;=> "1|2|3\n4|5|6"

;; Use either :lf (default) or :cr+lf as the newline character
(csv/write-csv [[1 2 3] [4 5 6]] :newline :cr+lf)
;;=> "1,2,3\r\n4,5,6"

;; Automatically quote fields that contain the separator
(csv/write-csv [["1,000" "2" "3"] ["4" "5,000" "6"]])
;;=> ""1,000",2,3\n4,"5,000",6"

;; Forcefully quote all fields
(csv/write-csv [["1,000" "2" "3"] ["4" "5,000" "6"]] :quote? true)
;;=> ""1,000","2","3"\n"4","5,000","6""

Alternatives

There's a CSV parser included in Google Closure.

Development

Running the tests:

$ lein cleantest

(assumes Leiningen 2.x)

Contributing

Thanks to all of our contributors.

We welcome all contributors to the project. Please submit an Issue and a Pull Request if you have one.

Documentation

More documentation can be found on the wiki.

License

Copyright © 2014 Test Double

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation? These fine people already did:
Ross Brandes, Matthew Boston, tugh, Ertuğrul Çetin & Kevin Baribeau
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close