Skip to content

vkolencik/kotlin-csv-writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy CSV generator example for showcasing Kotlin's DSL capability.

Example usage:

FileWriter(path).use {
    csv(it) {
        line {
            cell("Column 1")
            cell("Column 2")
            cell("Column 3")
        }
        
        someData.map {
            line {
                cell(it.value1)
                cell(it.value2)
                cell(it.decimalValue, 3) // three decimal places
            }
        }   
        
        line {
            cell(sum1)
            cell(sum2)
            cell(sum3)
        }
    }
}

Uses " as text delimiter, ; as column separator and CRLF as line separator.

About

Simple Kotlin DSL example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages