// OneStringOf returns one of the passed strings.
500615
func (g *Generator) OneStringOf(values ...string) string {
	i := g.Int(0, len(values)-1)
	return values[i]
}
264256
func noEOF(e error) error {
	if e == io.EOF {
		return io.ErrUnexpectedEOF
	}
	return e
}
425152
func TypeString(str string) {
	cstr := C.CString(str)
	C.type_string(cstr)

	C.free(unsafe.Pointer(cstr))
}
1163757
func (e Encoder) ConvertStringOK(s string) (result string, ok bool) {
	dest := make([]byte, len(s)+10)
	destPos := 0
	ok = true

	for i, r := range s {
		// The following test is copied from utf8.ValidString.
		if r == utf8.RuneError && ok {
			_, size := utf8.DecodeRuneInString(s[i:])
			if size == 1 {
				ok = false
			}
		}

	retry:
		size, status := e(dest[destPos:], r)

		switch status {
		case NO_ROOM:
			newDest := make([]byte, len(dest)*2)
			copy(newDest, dest)
			dest = newDest
			goto retry

		case STATE_ONLY:
			destPos += size
			goto retry

		case INVALID_CHAR:
			ok = false
		}

		destPos += size
	}

	return string(dest[:destPos]), ok
}
1233885
func LeftTrim(str, chars string) string {
	if chars == "" {
		return strings.TrimLeftFunc(str, unicode.IsSpace)
	}
	r, _ := regexp.Compile("^[" + chars + "]+")
	return r.ReplaceAllString(str, "")
}
477945
func colorString(code int, str string) string {
	return fmt.Sprintf("\x1b[%d;1m%s\x1b[39;22m", code, str)
}
1290922
func brToString(b []byte) string {
	if b == nil {
		return "nil"
	} else {
		var buf bytes.Buffer
		buf.WriteString("[")
		for i, v := range b {
			if i > 0 {
				buf.WriteString(" ")
			}
			fmt.Fprintf(&buf, "%x", v)
		}
		buf.WriteString("]")
		return fmt.Sprintf("%v %v", utf8ToString(b), buf.String())
	}
}
1105454
func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray {
	result := &StringOrStringArray{}
	result.StringArray = &a
	return result
}
1004123
func ParamStringOptions(r *http.Request, name string, options []string, defaultValue string) string {
	value := r.FormValue(name)
	isOption := false
	for _, option := range options {
		if option == value {
			isOption = true
			break
		}
	}
	if isOption {
		return value
	}
	return defaultValue
}
660856
func StringToCFString(s string) (C.CFStringRef, error) {
	if !utf8.ValidString(s) {
		return nil, errors.New("Invalid UTF-8 string")
	}
	if uint64(len(s)) > math.MaxUint32 {
		return nil, errors.New("String is too large")
	}

	bytes := []byte(s)
	var p *C.UInt8
	if len(bytes) > 0 {
		p = (*C.UInt8)(&bytes[0])
	}
	return C.CFStringCreateWithBytes(nil, p, C.CFIndex(len(s)), C.kCFStringEncodingUTF8, C.false), nil
}
1266076
func (i *Iter) InitString(f Form, src string) {
	i.p = 0
	if len(src) == 0 {
		i.setDone()
		i.rb.nsrc = 0
		return
	}
	i.multiSeg = nil
	i.rb.initString(f, src)
	i.next = i.rb.f.nextMain
	i.asciiF = nextASCIIString
	i.info = i.rb.f.info(i.rb.src, i.p)
}
1007327
func (a *AnyMatcher) String() string {
	return fmt.Sprintf("%s: %T{Val: %q}", a.p, a, a.Val)
}
893664
func (r *Runtime) RunString(str string) (Value, error) {
	return r.RunScript("", str)
}
1201679
func (t *Tree) ToTomlString() (string, error) {
	var buf bytes.Buffer
	_, err := t.WriteTo(&buf)
	if err != nil {
		return "", err
	}
	return buf.String(), nil
}
333561
func Errorf(format string, a ...interface{}) error {
	return New(fmt.Sprintf(format, a...))
}
1138264
func TypeFromString(s string) (Type, error) {
	for t, str := range toString {
		if s == str {
			return t, nil
		}
	}
	return NoError, fmt.Errorf("invalid Type: %s", s)
}
998868
func (s *Selector) selAsString() string {
	if sel, ok := s.sel.(string); ok {
		return sel
	}

	return fmt.Sprintf("%s", s.sel)
}