feat: support files with CRLF endings

Thanks to Armand !
master 0.5.1
Dominique Merle 2 years ago
parent f8f8e7bfb2
commit 1daac7990d

@ -0,0 +1,4 @@
,Reject,poor,fair,good,Very good,excellent
Massinissa,2,0,0,0,0,0
Armand,0,2,0,0,0,0
Thomas,0,0,1,1,0,0
1 Reject poor fair good Very good excellent
2 Massinissa 2 0 0 0 0 0
3 Armand 0 2 0 0 0 0
4 Thomas 0 0 1 1 0 0

@ -62,6 +62,12 @@ var testData = []struct {
"example/example11.ssv",
},
},
{
name: "CRLF, example12.ssv",
args: []string{
"example/example12.ssv",
},
},
{
name: "--sort usage, example.csv",
args: []string{

@ -31,6 +31,9 @@ func sanitizeInput(input string) string {
// Remove duplicate spaces
sanitized = regexp.MustCompile(` +`).ReplaceAllString(sanitized, " ")
// Remove Carriage Return (CRLF into LF)
sanitized = regexp.MustCompile(`\r\n`).ReplaceAllString(sanitized, "\n")
// …
return sanitized

Loading…
Cancel
Save