Does strings.SplitN(x, 1) always return []string{x}?
https://play.golang.org/p/3vDg_BFfY9
If so, I think the docs would be more clear if this was spelled out.
For example...
*** strings.go-OLD Mon Jul 4 15:33:24 2016
--- strings.go Mon Jul 4 15:34:48 2016
***************
*** 266,271 ****
--- 266,272 ----
// The count determines the number of substrings to return:
// n > 0: at most n substrings; the last substring will be the
unsplit remainder.
// n == 0: the result is nil (zero substrings)
+ // n == 1: the result is a list with one item (the value s)
// n < 0: all substrings
func SplitN(s, sep string, n int) []string { return genSplit(s, sep, 0, n) }
Tom
--
Email:
t...@whatexit.org Work: tlimo...@StackOverflow.com
Blog:
http://EverythingSysadmin.com