// getValidIntPrefix gets prefix of the string which can be successfully parsed as int.
505506
func getValidIntPrefix(sc *stmtctx.StatementContext, str string) (string, error) {
	floatPrefix, err := getValidFloatPrefix(sc, str)
	if err != nil {
		return floatPrefix, errors.Trace(err)
	}
	return floatStrToIntStr(sc, floatPrefix, str)
}
1194022
func (ns *Namespace) TrimPrefix(prefix, s interface{}) (string, error) {
	ss, err := cast.ToStringE(s)
	if err != nil {
		return "", err
	}

	sx, err := cast.ToStringE(prefix)
	if err != nil {
		return "", err
	}

	return _strings.TrimPrefix(ss, sx), nil
}
194203
func (e *etcdClient) GetPrefix(ctx context.Context, prefix string) (string, []byte, error) {
	duration := spanstat.Start()
	e.limiter.Wait(ctx)
	getR, err := e.client.Get(ctx, prefix, client.WithPrefix())
	increaseMetric(prefix, metricRead, "GetPrefix", duration.EndError(err).Total(), err)
	if err != nil {
		return "", nil, Hint(err)
	}

	if getR.Count == 0 {
		return "", nil, nil
	}
	return string(getR.Kvs[0].Key), getR.Kvs[0].Value, nil
}
259903
func (r *readerOffsets) searchPrefix(n int) int {
	i, j := 0, len(r.prefixes)
	for i < j {
		h := int(uint(i+j) >> 1)
		if n >= r.prefixes[h].total {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}
337797
func RegisterPrefix(pref string, ns string) {
	Register(Namespace{Prefix: pref, Full: ns})
}
869535
func matchPrefix(row chunk.Row, colIdx int, ad *types.Datum) bool {
	switch ad.Kind() {
	case types.KindString, types.KindBytes, types.KindBinaryLiteral, types.KindMysqlBit:
		return strings.HasPrefix(row.GetString(colIdx), ad.GetString())
	}
	return false
}
1318814
func (b *Builder) PathPrefix(pathPrefix string) *Builder {
	b.pathPrefix = pathPrefix
	return b
}
470645
func hasPrefix(buf []byte, prefix []byte) bool {
	trim := bytes.TrimLeftFunc(buf, unicode.IsSpace)
	return bytes.HasPrefix(trim, prefix)
}
813759
func CheckValidObjectNamePrefix(objectName string) error {
	if len(objectName) > 1024 {
		return errors.New("Object name cannot be greater than 1024 characters")
	}
	if !utf8.ValidString(objectName) {
		return errors.New("Object name with non UTF-8 strings are not supported")
	}
	return nil
}
1295310
func CheckPrefixFactory(prefixes ...string) func(string) (string, bool) {
	return func(content string) (string, bool) {
		for _, prefix := range prefixes {
			if strings.HasPrefix(content, prefix) {
				return strings.TrimPrefix(content, prefix), true
			}
		}
		return "", false
	}
}
7986
func (pq *PriorityQueue) generatePrefix(level uint8) []byte {
	// priority + prefixSep = 1 + 1 = 2
	prefix := make([]byte, 2)
	prefix[0] = byte(level)
	prefix[1] = prefixSep[0]
	return prefix
}
694042
func WithPrefix(ctx context.Context, prefix string) context.Context {
	return context.WithValue(ctx, ctxKeyPrefix, prefix)
}
848741
func parsePrefix(req *http.Request, b *structs.QueryOptions) {
	query := req.URL.Query()
	if prefix := query.Get("prefix"); prefix != "" {
		b.Prefix = prefix
	}
}
420420
func OptionPrefix(x string) Option {
	return func(p *Prompt) error {
		p.renderer.prefix = x
		return nil
	}
}
458195
func GetInstallationPrefix() (string, error) {
	var possibleInstallationPrefixes []string
	if isWindows() {
		programFilesPath := os.Getenv("PROGRAMFILES")
		if programFilesPath == "" {
			return "", fmt.Errorf("Cannot locate gauge shared file. Could not find Program Files directory.")
		}
		possibleInstallationPrefixes = []string{filepath.Join(programFilesPath, ProductName)}
	} else {
		possibleInstallationPrefixes = []string{"/usr/local", "/usr"}
	}

	for _, p := range possibleInstallationPrefixes {
		if FileExists(filepath.Join(p, "bin", ExecutableName())) {
			return p, nil
		}
	}

	return "", fmt.Errorf("Can't find installation files")
}
1266199
func (t *Trie) MatchPrefix(view []byte) string {
	for t != nil {
		if len(t.label) != 0 {
			return t.label
		}

		if len(view) == 0 {
			break
		}

		t = t.children[view[0]]
		view = view[1:]
	}

	return ""
}
1309667
func checkPrefixes(impl Implementation, prefixes []*net.IPNet) (err error) {
	IPIdentityCache.RLock()
	defer IPIdentityCache.RUnlock()

	if err = checkPrefixLengthsAgainstMap(impl, prefixes, IPIdentityCache.v4PrefixLengths, false); err != nil {
		return
	}
	return checkPrefixLengthsAgainstMap(impl, prefixes, IPIdentityCache.v6PrefixLengths, true)
}