Git Product home page Git Product logo

safecsv's Introduction

safecsv

A JVM library for reading CSV files without damaging content in Unicode characters beyond the basic multilingual plane.

Why?

Some widely used libraries for working with .csv files read arrays of bytes or streams of characters, and fail to preserve Unicode codepoints outside the basic multilingual plane. safecsv reads .csv sources by Unicode codepoint, so it is reliable rather than fast.

More information: http://neelsmith.github.io/safecsv/

Example: basic usage

This script (in groovy) reads a .csv file and prints the first column of every row:

import edu.holycross.shot.safecsv.SafeCsvReader

SafeCsvReader srcReader = new SafeCsvReader("CSVFILE")
srcReader.readAll().each { record ->
    println("First column is " + record[0])
}

Example: delimited text file with header line

This script (in groovy) reads a .csv file and prints the first column of every row labelled with the value from the corresponding header column:

import edu.holycross.shot.safecsv.SafeCsvReader

boolean hasHeader = true
SafeCsvReader srcReader = new SafeCsvReader("CSVFILE", true)
def headers = srcReader.readHeader()
srcReader.readAll().each { record ->
    println("Column " + headers[0] + ": " + record[0])
}

safecsv's People

Contributors

neelsmith avatar

Watchers

James Cloos avatar  avatar  avatar

safecsv's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.