Skip to content

csimplestring/go-csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-csv

This tiny tool is dedicated to automatically detects the CSV delimiter. It fully conforms to the specifications outlined on the on the Wikipedia article. Looking through many CSV libraries code and discussion on the stackoverflow, finding that their CSV delimiter detection is limited or incomplete or containing many unneeded features. Hoping this can people solve the CSV delimiter detection problem without importing extra overhead.

Usage

package main

import (
	"github.com/csimplestring/go-csv/detector"
	"os"
	"fmt"
)

func main()  {
	detector := detector.New()

	file, err := os.OpenFile("example.csv", os.O_RDONLY, os.ModePerm)
	if err != nil {
		os.Exit(1)
	}
	defer file.Close()

	delimiters := detector.DetectDelimiter(file, '"')
	fmt.Println(delimiters)
}

This tool is inspired by [parseCSV][link]. [link]: https://github.com/parsecsv/parsecsv-for-php

About

Auto detect CSV delimiter in Golang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages