Skip to content

Commit 81d03eb

Browse files
committed
minor fix
1 parent 1e579d2 commit 81d03eb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

table/render_tsv.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ func (t *Table) tsvRenderRow(out *strings.Builder, row rowStr, hint renderHint)
5050
}
5151

5252
if strings.ContainsAny(col, "\t\n\"") || strings.Contains(col, " ") {
53-
out.WriteString(fmt.Sprintf("\"%s\"", t.tsvFixDoubleQuotes(col)))
53+
col = strings.ReplaceAll(col, "\"", "\"\"") // fix double-quotes
54+
out.WriteString(fmt.Sprintf("\"%s\"", col))
5455
} else {
5556
out.WriteString(col)
5657
}
@@ -61,10 +62,6 @@ func (t *Table) tsvRenderRow(out *strings.Builder, row rowStr, hint renderHint)
6162
}
6263
}
6364

64-
func (t *Table) tsvFixDoubleQuotes(str string) string {
65-
return strings.Replace(str, "\"", "\"\"", -1)
66-
}
67-
6865
func (t *Table) tsvRenderRows(out *strings.Builder, rows []rowStr, hint renderHint) {
6966
for idx, row := range rows {
7067
hint.rowNumber = idx + 1

0 commit comments

Comments
 (0)