// extracts a string from byte array of a particular number of bytes.
181723
func extractString(source io.Reader, lenBytes int) (string, error) {
	myVal := make([]byte, lenBytes)
	_, err := source.Read(myVal)
	if err != nil {
		return "", err
	}
	return string(myVal), nil
}
1275862
func Hex2Bytes(str string) []byte {
	h, _ := hex.DecodeString(str)
	return h
}
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
}
437263
func (t *TM1638Driver) fromStringToByteArray(str string) []byte {
	chars := strings.Split(str, "")
	data := make([]byte, len(chars))

	for index, char := range chars {
		if val, ok := t.fonts[char]; ok {
			data[index] = val
		}
	}
	return data
}
1045099
func Bytes(val string) ([]byte, error) {
	b, err := base64.StdEncoding.DecodeString(val)
	if err != nil {
		b, err = base64.URLEncoding.DecodeString(val)
		if err != nil {
			return nil, err
		}
	}
	return b, nil
}
541292
func (v ByteView) String() string {
	if v.b != nil {
		return string(v.b)
	}
	return v.s
}
117975
func String(s string) int {
	v := int(crc32.ChecksumIEEE([]byte(s)))
	if v >= 0 {
		return v
	}
	if -v >= 0 {
		return -v
	}
	// v == MinInt
	return 0
}
190415
func skipLengthEncodedString(b []byte) (int, error) {
	// Get length
	num, _, n := readLengthEncodedInteger(b)
	if num < 1 {
		return n, nil
	}

	n += int(num)

	// Check data length
	if len(b) >= n {
		return n, nil
	}
	return n, io.EOF
}
607531
func (this Slice) String() string {
	wr := bytes.NewBuffer(nil)
	fmt.Fprint(wr, "Slice[")
	for i, v := range this {
		fmt.Fprintf(wr, "%v: %v", v.Key, print(v.Val))
		if i != len(this)-1 {
			fmt.Fprint(wr, " ")
		}
	}
	fmt.Fprintf(wr, "]")
	return wr.String()
}
345003
func splitAtBytes(s string, t string) []string {
	a := make([]string, 1+countAnyByte(s, t))
	n := 0
	last := 0
	for i := 0; i < len(s); i++ {
		if byteIndex(t, s[i]) >= 0 {
			if last < i {
				a[n] = string(s[last:i])
				n++
			}
			last = i + 1
		}
	}
	if last < len(s) {
		a[n] = string(s[last:])
		n++
	}
	return a[0:n]
}
1148136
func ParseString(b []byte) (string, error) {
	var stackbuf [unescapeStackBufSize]byte // stack-allocated array for allocation-free unescaping of small strings
	if bU, err := Unescape(b, stackbuf[:]); err != nil {
		return "", MalformedValueError
	} else {
		return string(bU), nil
	}
}
295491
func extractInt(s string) (int, error) {
	if s == "" {
		return 0, nil
	}
	return strconv.Atoi(s)
}
331568
func (re *RegExp) String() string {
	var b bytes.Buffer
	return re.toStringBuilder(&b).String()
}
64863
func (e *StringEncoder) Bytes() ([]byte, error) {
	// Compress the currently appended bytes using snappy and prefix with
	// a 1 byte header for future extension
	data := snappy.Encode(nil, e.bytes)
	return append([]byte{stringCompressedSnappy << 4}, data...), nil
}
212662
func UTF8StringFromBytes(b []byte) string {
	if utf8.Valid(b) {
		return string(b)
	}

	// This effectively replaces invalid bytes to \uFFFD (replacement char).
	return string(bytes.Runes(b))
}
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
}
877514
func Bytes(n int) []byte {
	b := make([]byte, n)
	Read(b)
	return b
}