// readStringN reads a string of a given length
11986
func (r *reader) readStringN(n uint32) string {
	return string(r.readBytes(n))
}
910913
func (s StringStringMap) GetString(key string) (string, error) {
	value, ok := s[key]
	if !ok {
		return "", nil
	}
	return value, nil
}
101205
func ReaderToString(lines io.Reader) string {
	if lines == nil {
		return ""
	}
	b := bp.GetBuffer()
	defer bp.PutBuffer(b)
	b.ReadFrom(lines)
	return b.String()
}
39221
func (*parser) parseString(b []byte) string {
	if i := bytes.IndexByte(b, 0); i >= 0 {
		return string(b[:i])
	}
	return string(b)
}
480309
func readPstring(r io.Reader) (*pstring, error) {
	var length int8
	e := binary.Read(r, byteOrder, &length)
	if e != nil {
		return nil, e
	}
	s := make([]byte, length)
	read, e := r.Read(s)
	if e != nil {
		return nil, e
	}
	if read != int(length) {
		return nil, fmt.Errorf("could not read %d bytes", length)
	}
	ps := pstring{
		length,
		bytes.NewBuffer(s).String(),
	}
	return &ps, nil
}
376398
func (p *TCompactProtocol) ReadString() (value string, err error) {
	length, e := p.readVarint32()
	if e != nil {
		return "", NewTProtocolException(e)
	}
	if length < 0 {
		return "", invalidDataLength
	}

	if length == 0 {
		return "", nil
	}
	var buf []byte
	if length <= int32(len(p.buffer)) {
		buf = p.buffer[0:length]
	} else {
		buf = make([]byte, length)
	}
	_, e = io.ReadFull(p.trans, buf)
	return string(buf), NewTProtocolException(e)
}
694343
func (bj BinaryJSON) GetString() []byte {
	strLen, lenLen := uint64(bj.Value[0]), 1
	if strLen >= utf8.RuneSelf {
		strLen, lenLen = binary.Uvarint(bj.Value)
	}
	return bj.Value[lenLen : lenLen+int(strLen)]
}
72481
func (b *SelectStmt) ReturnString() (string, error) {
	var v string
	err := b.LoadOne(&v)
	return v, err
}
1286788
func (r *importReader) readString() {
	switch r.nextByte(true) {
	case '`':
		for r.err == nil {
			if r.nextByte(false) == '`' {
				break
			}
			if r.eof {
				r.syntaxError()
			}
		}
	case '"':
		for r.err == nil {
			c := r.nextByte(false)
			if c == '"' {
				break
			}
			if r.eof || c == '\n' {
				r.syntaxError()
			}
			if c == '\\' {
				r.nextByte(false)
			}
		}
	default:
		r.syntaxError()
	}
}
1115855
func (e *StringDecoder) Read() string {
	// Read the length of the string
	length, n := binary.Uvarint(e.b[e.i:])
	if n <= 0 {
		e.err = fmt.Errorf("stringDecoder: invalid encoded string length")
		return ""
	}

	// The length of this string plus the length of the variable byte encoded length
	e.l = int(length) + n

	lower := e.i + n
	upper := lower + int(length)
	if upper < lower {
		e.err = fmt.Errorf("stringDecoder: length overflow")
		return ""
	}
	if upper > len(e.b) {
		e.err = fmt.Errorf("stringDecoder: not enough data to represent encoded string")
		return ""
	}

	return string(e.b[lower:upper])
}
689290
func (l *Loader) LoadString(in string) (*config.Values, error) {
	return l.LoadBytes([]byte(in))
}
568529
func (s *Scanner) readN(n int) string {
	var buf bytes.Buffer
	for i := 0; i < n; i++ {
		ch := s.read()
		if ch == eof {
			break
		}
		buf.WriteRune(ch)
	}
	return buf.String()
}
820167
func ParseString(s string, options ...Option) (*Token, error) {
	return Parse(strings.NewReader(s), options...)
}
934730
func ReadN(r io.Reader, n int) ([]byte, error) {
	data := make([]byte, n)
	_, err := r.Read(data)

	if err != nil {
		return nil, err
	}

	return data, nil
}
878642
func chunkString(str string, size int) []string {
	if str == "" {
		return []string{}
	}

	if size == 0 {
		return []string{str}
	}

	chunks := make([]string, int64(math.Ceil(float64(len(str))/float64(size))))

	for len(str) < len(chunks)*size {
		str = " " + str
	}

	for i := 0; i < len(chunks); i++ {
		start := i * size
		stop := int64(math.Min(float64(start+size), float64(len(str))))
		chunks[i] = str[start:stop]
	}

	chunks[0] = strings.TrimLeft(chunks[0], " ")

	return chunks
}
754078
func (*parser) parseString(b []byte) string {
	n := 0
	for n < len(b) && b[n] != 0 {
		n++
	}
	return string(b[0:n])
}
56997
func GetString(n ast.Node) (string, error) {
	if node, ok := n.(*ast.BasicLit); ok && node.Kind == token.STRING {
		return strconv.Unquote(node.Value)
	}
	return "", fmt.Errorf("Unexpected AST node type: %T", n)
}