Code Monkey home page Code Monkey logo

all-about-that-csv's Introduction

All About That CSV

Version 0.1

Target

A utility for every possible need related to csv

Manual & API

API:

// API class:
AboutCSV aboutCSV = new AboutCSV();

// generate random CSV API:
aboutCSV.genCSV().genAddressBook_toRaw(numOfEntries, targetFilePath);
                 .genAddressBook_toCompact(numOfEntries, targetFilePath);
                 .genHarryPotter_toRaw(numOfEntries, targetFilePath);
                 .genHarryPotter_toCompact(numOfEntries, targetFilePath);

// read and print CSV API:
aboutCSV.readCSV().printCSV_toRaw(targetFilePath);
                  .printCSV_toCompact(targetFilePath);
                  .printCSV_toTabulated(targetFilePath);

// convert CSV API:
aboutCSV.convertCSV().convertCSV_toCompact(fromFilePath, toFilePath);
                     .convertCSV_toTabulated(fromFilePath, toFilePath);

Format Example:

Compact:
Print CSV as Raw Format Done
Print CSV to Compact Format from: /Users/jibinzou/Documents/all-about-that-csv/files/input/testCSVFile1.csv
-------------start---------------
firstName,lastName,phoneNumber,streetName,city,state,zipCode,country
Davis,Glover,641-359-3720,Ronald Burgs,Port Rudolfstad,Alaska,19977-2116,Libyan Arab Jamahiriya
Ivonne,Orn,562.382.6524,Heike Crossroad,Swaniawskimouth,Wisconsin,90639-8043,Tajikistan
Manual,,(602) 714-2617 x086,Muller Summit,Port Trevor,West Virginia,06273-1121,Luxembourg
Arturo,1-510-741-1469 x521,Imogene Extensions,East Chong,Rhode Island,85554,Italy
Alta,Stehr,470.327.7810,Tremblay Isle,Littelhaven,Nevada,87590,Barbados
Mariel,Fay,1-791-865-6426 x194,Kari Trace,East Dominickburgh,North Carolina,89708,Yemen
Kenneth,Wiegand,267.508.0326 x56546,Upton Ports,East Estela,Maine,55551-0451,Jersey
Rheba,Cruickshank,(645) 181-9617 x04329,Guadalupe Forges,South Jerilyntown,Michigan,28790,San Marino
Kendall,Stiedemann,837.645.6997 x11053,Oren Mission,Port Easter,South Dakota,08358,Senegal
Angella,Leffler,888-744-5550,Macejkovic Crest,Pollichborough,Kentucky,40845,Bosnia and Herzegovina
--------------end----------------
Print CSV to Compact Format Done

Tabulated (nicely spaced by whitespaces, not tabs):
Print CSV to Tabulated Format from: /Users/jibinzou/Documents/all-about-that-csv/files/input/testCSVFile1.csv
-------------start---------------
 firstName , lastName            , phoneNumber           , streetName       , city               , state          , zipCode    , country                
 Davis     , Glover              , 641-359-3720          , Ronald Burgs     , Port Rudolfstad    , Alaska         , 19977-2116 , Libyan Arab Jamahiriya 
 Ivonne    , Orn                 , 562.382.6524          , Heike Crossroad  , Swaniawskimouth    , Wisconsin      , 90639-8043 , Tajikistan             
 Manual    ,                     , (602) 714-2617 x086   , Muller Summit    , Port Trevor        , West Virginia  , 06273-1121 , Luxembourg             
 Arturo    , 1-510-741-1469 x521 , Imogene Extensions    , East Chong       , Rhode Island       , 85554          , Italy      ,                        
 Alta      , Stehr               , 470.327.7810          , Tremblay Isle    , Littelhaven        , Nevada         , 87590      , Barbados               
 Mariel    , Fay                 , 1-791-865-6426 x194   , Kari Trace       , East Dominickburgh , North Carolina , 89708      , Yemen                  
 Kenneth   , Wiegand             , 267.508.0326 x56546   , Upton Ports      , East Estela        , Maine          , 55551-0451 , Jersey                 
 Rheba     , Cruickshank         , (645) 181-9617 x04329 , Guadalupe Forges , South Jerilyntown  , Michigan       , 28790      , San Marino             
 Kendall   , Stiedemann          , 837.645.6997 x11053   , Oren Mission     , Port Easter        , South Dakota   , 08358      , Senegal                
 Angella   , Leffler             , 888-744-5550          , Macejkovic Crest , Pollichborough     , Kentucky       , 40845      , Bosnia and Herzegovina 
--------------end----------------
Print CSV to Tabulated Format Done

CSV Parsing Criteria:

// pattern inside of arrows ->,<whitespaces and tabs>"xxxxxx"<whitespaces and tabs>,<-
// will be treated as one cell of CSV
Pattern.compile(",[ \t]*?\".*?\"[ \t]*?(,|$)")

Coding Style

General Java Coding style

Author

redlogo

Copyright

Copyright © 2019 - 2020 redlogo

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.