go-csvvalue – github.com/tonistiigi/go-csvvalue Index | Files

package csvvalue

import "github.com/tonistiigi/go-csvvalue"

Package csvvalue provides an efficient parser for a single line CSV value. It is more efficient than the standard library csv package for parsing many small values. For multi-line CSV parsing, the standard library is recommended.

Index

Functions

func Fields

func Fields(inp string, dst []string) ([]string, error)

Fields parses the line with default parser and returns slice of fields for the record. If dst is nil, a new slice is allocated.

Types

type Parser

type Parser struct {
	Comma            rune
	LazyQuotes       bool
	TrimLeadingSpace bool
}

Parser is a CSV parser for a single line value.

func NewParser

func NewParser() *Parser

NewParser returns a new Parser with default settings.

func (*Parser) Fields

func (r *Parser) Fields(line string, dst []string) ([]string, error)

Fields parses the line and returns slice of fields for the record. If dst is nil, a new slice is allocated. For backward compatibility, a trailing newline is allowed.

Source Files

csvvalue.go

Version
v0.0.0-20240814133006-030d3b2625d0 (latest)
Published
Aug 14, 2024
Platform
js/wasm
Imports
6 packages
Last checked
4 weeks ago

Tools for package owners.