// ParseString 从字符串中初始化 Config 对象，由 unmarshal 决定解析方式
494232
func ParseString(data string, unmarshal func([]byte, interface{}) error) (*Config, error) {
	conf := &Config{}
	if err := unmarshal([]byte(data), conf); err != nil {
		return nil, err
	}

	if err := conf.Sanitize(); err != nil {
		return nil, err
	}
	return conf, nil
}
1143093
func DecodeString(in string, val interface{}) error {
	buf := strings.NewReader(in)
	d := NewDecoder(buf)
	return d.Decode(val)
}
1053776
func ParseString(cfg API, input string) *Iterator {
	return ParseBytes(cfg, []byte(input))
}
561257
func ParseString(s string) (*Query, error) {
	return NewParser(strings.NewReader(s)).Parse()
}
813723
func (n *NullUint64) ParseStringValue(val string) error {
	if val == "" {
		return nil
	}

	uint64Val, err := strconv.ParseUint(val, 10, 64)
	if err != nil {
		return err
	}

	n.Value = uint64Val
	n.IsSet = true

	return nil
}
943399
func (enc *Encoding) DecodeString(s string) ([]byte, error) {
	result := new(big.Int)
	for i := range s {
		n, ok := enc.index[s[i]]
		if !ok {
			return nil, fmt.Errorf("invalid character %q at index %d", s[i], i)
		}
		result = result.Add(result.Mul(result, enc.base), n)
	}
	return result.Bytes(), nil
}
1076143
func (bd *BinaryDecoder) ReadString() (string, error) {
	if err := checkEOF(bd.buf, bd.pos, 1); err != nil {
		return "", err
	}
	length, err := bd.ReadLong()
	if err != nil || length < 0 {
		return "", InvalidStringLength
	}
	if err := checkEOF(bd.buf, bd.pos, int(length)); err != nil {
		return "", err
	}
	value := string(bd.buf[bd.pos : bd.pos+length])
	bd.pos += length
	return value, nil
}
754051
func (c *ConfigParser) ReadString(s string) (err error) {
	r := strings.NewReader(s)
	return c.Read(r)
}
336074
func parseConfigString(configString string) (configName, presentName string, err error) {
	tokens := strings.Split(configString, ":")

	configName = strings.TrimSpace(tokens[0])

	if configName == "" {
		err = fmt.Errorf("invalid config name provided")
		return
	}

	if len(tokens) > 1 {
		presentName = strings.TrimSpace(tokens[1])
		if presentName == "" {
			err = fmt.Errorf("invalid presentation name provided")
			return
		}
	} else {
		presentName = configName
	}
	return
}
607603
func (enc *Encoding) DecodeString(s string) ([]byte, error) {
	dbuf := make([]byte, enc.DecodedLen(len(s)))
	n, _, err := enc.decode(dbuf, []byte(s))
	return dbuf[:n], err
}
1317297
func UnmarshalStringToChan(in string, c interface{}) error {
	return UnmarshalToChan(strings.NewReader(in), c)
}
1216571
func (dec *Decoder) DecodeString(v *string) error {
	if dec.isPooled == 1 {
		panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder"))
	}
	return dec.decodeString(v)
}
854183
func ReadString(r Reader) (String, error) {
	var s String
	err := s.ReadFrom(r, UNKNOWN_LEN)
	return s, err
}
494529
func FromConfigString(config, configType string) (Provider, error) {
	v := newViper()
	m, err := readConfig(metadecoders.FormatFromString(configType), []byte(config))
	if err != nil {
		return nil, err
	}

	v.MergeConfigMap(m)

	return v, nil
}
190159
func (l Lexer) TokenizeString(s string) ([]Token, error) {
	r := bufio.NewReader(strings.NewReader(s))
	tokens := []Token{}
	err := l.Tokenize(r, func(t Token) error {
		tokens = append(tokens, t)
		return nil
	})
	return tokens, err
}
59958
func (c Config) GetString(key string) (string, error) {
	var (
		strout string
		val    interface{}
		ok     bool
	)

	if val, ok = c[key]; !ok {
		return strout, ErrConfigNotFound
	}
	if strout, ok = val.(string); !ok {
		return strout, ErrNotAString
	}
	return strout, nil
}
330333
func Parse(name string, text string) (*Config, error) {
	p := &parser{name: name, text: text}
	err := p.parse()
	if err != nil {
		return nil, err
	}
	return p.config, nil
}