-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ftpserver | ||
|
||
import ( | ||
"encoding/csv" | ||
"strings" | ||
) | ||
|
||
func advSplitN(s string, sep rune, n int) ([]string, error) { | ||
r := csv.NewReader(strings.NewReader(s)) | ||
r.Comma = sep | ||
record, err := r.Read() | ||
if err != nil { | ||
Check failure on line 12 in string_utils.go GitHub Actions / build (1.22)
|
||
return nil, err | ||
} | ||
if len(record) > n { | ||
Check failure on line 15 in string_utils.go GitHub Actions / build (1.22)
|
||
return record[:n], nil | ||
} | ||
return record, nil | ||
Check failure on line 18 in string_utils.go GitHub Actions / build (1.22)
|
||
} |