// splitLine is like strings.Split(string, " "), but splits
// strings by any whitespace characters, discarding them in
// the process.
977095
func splitLine(line string) []string {
	var s []string
	var start, end int
	for ; start < len(line); start++ {
		c := line[start]
		if !isWhitespace(c) {
			break
		}
	}
	var ws bool
	for end = start; end < len(line); end++ {
		c := line[end]
		if !isWhitespace(c) {
			ws = false
			continue
		}
		if ws == true {
			start++
			continue
		}
		ws = true
		s = append(s, line[start:end])
		start = end + 1
	}
	if start != end {
		s = append(s, line[start:end])
	}
	return s
}
1016606
func split(text []byte) [][]byte {
	// count lines (comment text never ends in a newline)
	n := 1
	for _, c := range text {
		if c == '\n' {
			n++
		}
	}

	// split
	lines := make([][]byte, n)
	n = 0
	i := 0
	for j, c := range text {
		if c == '\n' {
			lines[n] = text[i:j] // exclude newline
			i = j + 1            // discard newline
			n++
		}
	}
	lines[n] = text[i:]

	return lines
}
377177
func Splitlines(s string) []string {
	s = strings.Replace(s, "\r", "\n", -1)
	s = strings.Replace(s, "\r\n", "\n", -1)
	return MapS(trimnewlines, FilterS(nonempty, strings.Split(s, "\n")))
}
453221
func splitExtension(path string) (string, string) {
	for i := len(path) - 1; i > 0; i-- {
		switch path[i] {
		case '.':
			// Handle some multipart extensions
			if i >= 4 && path[i-4:i] == ".tar" {
				i -= 4
			}
			// A leading dot is not an extension
			if i == 0 || path[i-1] == '/' || path[i-1] == '\\' {
				return path, ""
			}
			return path[:i], path[i:]
		case '/', '\\', ' ':
			return path, ""
		}
	}
	return path, ""
}
216830
func split(str string) []string {
	// check if consecutive single char things make up an initialism
	once.Do(func() {
		splitRex1 = regexp.MustCompile(`(\p{Lu})`)
		splitRex2 = regexp.MustCompile(`(\pL|\pM|\pN|\p{Pc})+`)
		splitReplacer = strings.NewReplacer(
			"@", "At ",
			"&", "And ",
			"|", "Pipe ",
			"$", "Dollar ",
			"!", "Bang ",
			"-", " ",
			"_", " ",
		)
		ensureSorted()
	})

	str = trim(str)

	// Convert dash and underscore to spaces
	str = splitReplacer.Replace(str)

	// Split when uppercase is found (needed for Snake)
	str = splitRex1.ReplaceAllString(str, " $1")

	for _, k := range initialisms {
		str = strings.Replace(str, splitRex1.ReplaceAllString(k, " $1"), " "+k, -1)
	}
	// Get the final list of words
	//words = rex2.FindAllString(str, -1)
	return splitRex2.FindAllString(str, -1)
}
26764
func splitPath(path, separator string) []string {
	return stringex.SplitFilter(path, separator, func(part string) bool {
		return part != ""
	})
}
80839
func split(s string) <-chan string {
	ch := make(chan string)
	go func() {
		s = strings.Replace(s, " ", "", -1)
		if !strings.Contains(s, "(") {
			ch <- s
		} else {
			last := 0
			end := len(s)
			for info := range scan(s) {
				if last != info.openPos {
					ch <- s[last:info.openPos]
				}
				ch <- s[info.openPos:info.closePos]
				last = info.closePos
			}
			if last != end {
				ch <- s[last:]
			}
		}
		close(ch)
	}()
	return ch
}
539622
func ParseStringSlice(input string, sep string) []string {
	input = strings.TrimSpace(input)
	if input == "" {
		return []string{}
	}

	splitStr := strings.Split(input, sep)
	ret := make([]string, len(splitStr))
	for i, val := range splitStr {
		ret[i] = strings.TrimSpace(val)
	}

	return ret
}
1063640
func splitArgs(args []string) (string, []string) {
	if len(args) >= 1 && len(args[0]) >= 1 && string(args[0][0]) != "-" {
		if len(args) == 1 {
			return strings.ToLower(args[0]), []string{}
		}
		return strings.ToLower(args[0]), args[1:]
	}
	return "", args
}
666087
func SplitPath(p string) []string {
	dir, file := filepath.Split(p)
	if dir == "" || dir == "/" {
		return []string{file}
	}
	dir = filepath.Clean(dir)
	return append(SplitPath(dir), file)
}
89770
func (c Context) Split(s string, sep string) []string {
	return strings.Split(s, sep)
}
56791
func (s *Semver) Split() (uint32, uint32, uint32) {
	return s.major, s.minor, s.patch
}
1246574
func split(s string, c string, cutc bool) (string, string) {
	i := strings.Index(s, c)
	if i < 0 {
		return s, ""
	}
	if cutc {
		return s[:i], s[i+len(c):]
	}
	return s[:i], s[i:]
}
600251
func SplitList(b []byte) (content, rest []byte, err error) {
	k, content, rest, err := Split(b)
	if err != nil {
		return nil, b, err
	}
	if k != List {
		return nil, b, ErrExpectedList
	}
	return content, rest, nil
}
162016
func SplitWhite(s string) ([]string, error) {
	reg, err := regexp.Compile("[ \t]+")
	if err != nil {
		return nil, err
	}
	s = reg.ReplaceAllString(s, " ")
	return strings.Split(s, " "), nil
}
1293655
func splitSpecial(s string, delimiter string, cutdelimiter bool) (string, string) {
	i := strings.Index(s, delimiter)
	if i < 0 {
		// if delimiter not found return as is.
		return s, ""
	}
	// if delimiter should be removed, remove it.
	if cutdelimiter {
		return s[0:i], s[i+len(delimiter):]
	}
	// return split strings with delimiter
	return s[0:i], s[i:]
}
671319
func TrimLines(input []string) []string {
	result := make([]string, 0, len(input))
	for _, el := range input {
		result = append(result, strings.TrimSpace(el))
	}
	return result
}