// split this scalar range if it overlaps with a surrogate codepoint
496194
func (s *scalarRange) split() (scalarRange, scalarRange) {
	if s.start < 0xe000 && s.end > 0xd7ff {
		return scalarRange{
				start: s.start,
				end:   0xd7ff,
			},
			scalarRange{
				start: 0xe000,
				end:   s.end,
			}
	}
	return nilScalarRange, nilScalarRange
}
464977
func splitOption(prefix string, option string, islong bool) (string, string, *string) {
	pos := strings.Index(option, "=")

	if (islong && pos >= 0) || (!islong && pos == 1) {
		rest := option[pos+1:]
		return option[:pos], "=", &rest
	}

	return option, "", nil
}
1001972
func NewSplitter(splitParams *SplitParams, algorithm SplitAlgorithmInterface) *Splitter {
	var splitter Splitter
	splitter.splitParams = splitParams
	splitter.algorithm = algorithm
	splitter.splitParams = splitParams

	splitColumns := algorithm.getSplitColumns()
	splitter.startBindVariableNames = make([]string, 0, len(splitColumns))
	splitter.endBindVariableNames = make([]string, 0, len(splitColumns))
	for _, splitColumn := range splitColumns {
		splitter.startBindVariableNames = append(
			splitter.startBindVariableNames, startBindVariablePrefix+splitColumn.Name.CompliantName())
		splitter.endBindVariableNames = append(
			splitter.endBindVariableNames, endBindVariablePrefix+splitColumn.Name.CompliantName())
	}
	splitter.initQueryPartSQLs()
	return &splitter
}
225923
func (r *copRanges) split(key []byte) (*copRanges, *copRanges) {
	n := sort.Search(r.len(), func(i int) bool {
		cur := r.at(i)
		return len(cur.EndKey) == 0 || bytes.Compare(cur.EndKey, key) > 0
	})
	// If a range p contains the key, it will split to 2 parts.
	if n < r.len() {
		p := r.at(n)
		if bytes.Compare(key, p.StartKey) > 0 {
			left := r.slice(0, n)
			left.last = &kv.KeyRange{StartKey: p.StartKey, EndKey: key}
			right := r.slice(n+1, r.len())
			right.first = &kv.KeyRange{StartKey: key, EndKey: p.EndKey}
			return left, right
		}
	}
	return r.slice(0, n), r.slice(n, r.len())
}
958534
func splitBuffer(b *bytes.Buffer, delim string) (*bytes.Buffer, *bytes.Buffer) {
	scanner := bufio.NewScanner(b)

	// Read and check first line
	if !scanner.Scan() {
		return nil, nil
	}
	if string(bytes.TrimSpace(scanner.Bytes())) != delim {
		return nil, nil
	}

	// Accumulate metadata, until delimiter
	meta := bytes.NewBuffer(nil)
	for scanner.Scan() {
		if string(bytes.TrimSpace(scanner.Bytes())) == delim {
			break
		}
		if _, err := meta.Write(scanner.Bytes()); err != nil {
			return nil, nil
		}
		if _, err := meta.WriteRune('\n'); err != nil {
			return nil, nil
		}
	}
	// Make sure we saw closing delimiter
	if string(bytes.TrimSpace(scanner.Bytes())) != delim {
		return nil, nil
	}

	// The rest is markdown
	markdown := new(bytes.Buffer)
	for scanner.Scan() {
		if _, err := markdown.Write(scanner.Bytes()); err != nil {
			return nil, nil
		}
		if _, err := markdown.WriteRune('\n'); err != nil {
			return nil, nil
		}
	}

	return meta, markdown
}
32877
func (p *point) Split(size int) []Point {
	if p.time.IsZero() || p.StringSize() <= size {
		return []Point{p}
	}

	// key string, timestamp string, spaces
	size -= len(p.key) + len(strconv.FormatInt(p.time.UnixNano(), 10)) + 2

	var points []Point
	var start, cur int

	for cur < len(p.fields) {
		end, _ := scanTo(p.fields, cur, '=')
		end, _ = scanFieldValue(p.fields, end+1)

		if cur > start && end-start > size {
			points = append(points, &point{
				key:    p.key,
				time:   p.time,
				fields: p.fields[start : cur-1],
			})
			start = cur
		}

		cur = end + 1
	}

	points = append(points, &point{
		key:    p.key,
		time:   p.time,
		fields: p.fields[start:],
	})

	return points
}
1201768
func splitBound(edgeBound r2.Rect, uEnd, vEnd int, u, v float64) [2]r2.Rect {
	var childBounds = [2]r2.Rect{
		edgeBound,
		edgeBound,
	}

	if uEnd == 1 {
		childBounds[0].X.Lo = u
		childBounds[1].X.Hi = u
	} else {
		childBounds[0].X.Hi = u
		childBounds[1].X.Lo = u
	}

	if vEnd == 1 {
		childBounds[0].Y.Lo = v
		childBounds[1].Y.Hi = v
	} else {
		childBounds[0].Y.Hi = v
		childBounds[1].Y.Lo = v
	}

	return childBounds
}
708051
func (s Subscription) SplitErr() (p, n string, err error) {
	p, n, err = resourceProjectName(string(s))
	return
}
395344
func split(s string) (a []rune) {
	for _, ch := range s {
		a = append(a, ch)
	}
	return
}
1373292
func splitRange(value string) (string, string, error) {
	p := strings.SplitN(value, ",", 2)
	if len(p) != 2 || p[0] == "" || p[1] == "" {
		return "", "", fmt.Errorf("date: failed to parse date range '%s'", value)
	}
	return strings.ToLower(p[0][1:]), strings.ToLower(p[1][:len(p[1])-1]), nil
}
961613
func (cs Set) Split() (domain, target, ref string) {
	switch p := strings.SplitN(string(cs), "/", 3); len(p) {
	case 1:
		return p[0], "", ""
	case 2:
		return p[0], p[1], ""
	default:
		return p[0], p[1], p[2]
	}
}
433722
func split(str string) []string {
	// FIXME: This isn't a perfect solution.
	// ex. WEiRD CaSINg (Support for 13 year old developers)
	return strings.Split(regexp.MustCompile(`-|_|([a-z])([A-Z])`).ReplaceAllString(strings.Trim(str, `-|_| `), `$1 $2`), ` `)
}
56791
func (s *Semver) Split() (uint32, uint32, uint32) {
	return s.major, s.minor, s.patch
}
713721
func Split(m Multiaddr) []Multiaddr {
	if _, ok := m.(*Component); ok {
		return []Multiaddr{m}
	}
	var addrs []Multiaddr
	ForEach(m, func(c Component) bool {
		addrs = append(addrs, &c)
		return true
	})
	return addrs
}
141875
func (conn *FakeVTGateConn) SplitQuery(
	ctx context.Context,
	keyspace string,
	query string,
	bindVars map[string]*querypb.BindVariable,
	splitColumns []string,
	splitCount int64,
	numRowsPerQueryPart int64,
	algorithm querypb.SplitQueryRequest_Algorithm) ([]*vtgatepb.SplitQueryResponse_Part, error) {

	response, ok := conn.splitQueryMap[getSplitQueryKey(
		keyspace, query, splitColumns, splitCount, numRowsPerQueryPart, algorithm)]
	if !ok {
		return nil, fmt.Errorf(
			"no match for keyspace: %s,"+
				" query: %v,"+
				" splitColumns: %v,"+
				" splitCount: %v"+
				" numRowsPerQueryPart: %v"+
				" algorithm: %v",
			keyspace, query, splitColumns, splitCount, numRowsPerQueryPart, algorithm)
	}
	reply := make([]*vtgatepb.SplitQueryResponse_Part, len(response.reply))
	copy(reply, response.reply)
	return reply, nil
}
1010813
func (sc scanCloser) Split(split bufio.SplitFunc) {
	sc.scanner.Split(split)
}
862393
func Split(data []byte, atEOF bool) (advance int, token []byte, err error) {
	return split(false, data, atEOF)
}