simple tabulation
This commit is contained in:
parent
7bf103427b
commit
62296e1da6
10
csvparser.go
10
csvparser.go
|
@ -107,12 +107,12 @@ func (p *CsvParser) Parse(line string) (map[string]string, error) {
|
||||||
|
|
||||||
// current rune is a delimiter, a value is present and the next char is the next value
|
// current rune is a delimiter, a value is present and the next char is the next value
|
||||||
if isDelimiter || index == maxIndex {
|
if isDelimiter || index == maxIndex {
|
||||||
if index == maxIndex && valueStart == -1 {
|
if index == maxIndex && valueStart == -1 {
|
||||||
valueStart = 0
|
valueStart = 0
|
||||||
}
|
}
|
||||||
state.delimiter = true
|
state.delimiter = true
|
||||||
field := line[valueStart:index +1]
|
field := line[valueStart : index+1]
|
||||||
field = strings.TrimRight(field,p.delimiters)
|
field = strings.TrimRight(field, p.delimiters)
|
||||||
if state.enclosed {
|
if state.enclosed {
|
||||||
field = strings.TrimRight(strings.TrimLeft(field, string(state.encloserStart)), string(state.encloserEnd))
|
field = strings.TrimRight(strings.TrimLeft(field, string(state.encloserStart)), string(state.encloserEnd))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue