// transform s from CamelCase to camel-case
329999
func CamelToFlag(s string) string {
	rs := []rune(s)
	buf := bytes.NewBuffer(make([]byte, 0, len(rs)+5))
	for i := 0; i < len(rs); i++ {
		if unicode.IsUpper(rs[i]) && i > 0 {
			buf.WriteString(flagDivider)
		}
		buf.WriteRune(unicode.ToLower(rs[i]))
	}
	return strings.ToLower(buf.String())
}
32939
func (q *SimpleQueryStringQuery) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *SimpleQueryStringQuery {
	q.lowercaseExpandedTerms = &lowercaseExpandedTerms
	return q
}
14
func (c Caser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
	nSrc = len(src) // Always read all the bytes of src
	result := c.Bytes(src)
	if len(result) > len(dst) {
		err = transform.ErrShortDst
	}
	nDst = copy(dst, result)
	return
}
957342
func FirstUpper(s string) string {
	if s == "" {
		return ""
	}
	r, n := utf8.DecodeRuneInString(s)
	return string(unicode.ToUpper(r)) + s[n:]
}
526142
func ToUpperString(b byte) string {
	if IsLower(b) {
		b = b - 'a' + 'A'
	}

	return string(b)
}
1006078
func goifyToCamelCase(val string) string {
	if len(val) == 0 {
		return ""
	}
	var b bytes.Buffer
	var prev rune
	for i, v := range val {
		if unicode.IsUpper(v) && unicode.IsUpper(prev) {
			b.WriteRune(unicode.ToLower(v))
		} else {
			if unicode.IsUpper(prev) {
				if i != 0 {
					b.Truncate(i - 1)
					b.WriteRune(unicode.ToUpper(prev))
				}
			}
			b.WriteRune(v)
		}
		prev = v
	}
	return b.String()
}
998817
func ToUpperFirst(s1 string) string {
	a1 := []rune(s1)
	a1[0] = unicode.ToUpper(a1[0])
	return string(a1)
	/*
			if s == "" {
			return ""
		}
		r, n := utf8.DecodeRuneInString(s)
		return string(unicode.ToUpper(r)) + s[n:]
	*/
}
77793
func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interface{}, error) {
	if mapping, ok := value.(map[interface{}]interface{}); ok {
		dict := make(map[string]interface{})
		for key, entry := range mapping {
			str, ok := key.(string)
			if !ok {
				return nil, formatInvalidKeyError(keyPrefix, key)
			}
			var newKeyPrefix string
			if keyPrefix == "" {
				newKeyPrefix = str
			} else {
				newKeyPrefix = fmt.Sprintf("%s.%s", keyPrefix, str)
			}
			convertedEntry, err := convertToStringKeysRecursive(entry, newKeyPrefix)
			if err != nil {
				return nil, err
			}
			dict[str] = convertedEntry
		}
		return dict, nil
	}
	if list, ok := value.([]interface{}); ok {
		var convertedList []interface{}
		for index, entry := range list {
			newKeyPrefix := fmt.Sprintf("%s[%d]", keyPrefix, index)
			convertedEntry, err := convertToStringKeysRecursive(entry, newKeyPrefix)
			if err != nil {
				return nil, err
			}
			convertedList = append(convertedList, convertedEntry)
		}
		return convertedList, nil
	}
	return value, nil
}
1060796
func camel(str string) string {
	pieces := strings.Split(str, "_")
	for i := 1; i < len(pieces); i++ {
		pieces[i] = string(unicode.ToUpper(rune(pieces[i][0]))) + pieces[i][1:]
	}
	return strings.Join(pieces, "")
}
353422
func ToCamel(s string) string {
	num := len(s)
	need := true

	var prev byte = ' '
	camel := make([]byte, 0, len(s))
	for i := 0; i < num; i++ {
		c := s[i]
		if c >= 'a' && c <= 'z' {
			if need {
				c = c - 'a' + 'A'
				need = false
			}
		} else {
			if prev == '_' {
				camel = append(camel, '_')
			}
			need = (c == '_' || c == ' ')
			if c == '_' {
				prev = '_'
				continue
			}
		}

		prev = c
		camel = append(camel, c)
	}

	return string(camel)
}
160540
func LessIgnoreCase(first string, second string) bool {
	iRunes := []rune(first)
	jRunes := []rune(second)

	max := len(iRunes)
	if max > len(jRunes) {
		max = len(jRunes)
	}

	for idx := 0; idx < max; idx++ {
		ir := iRunes[idx]
		jr := jRunes[idx]

		lir := unicode.ToLower(ir)
		ljr := unicode.ToLower(jr)

		if lir == ljr {
			continue
		}

		return lir < ljr
	}

	return false
}
972034
func CamelCase(in string) string {
	tokens := strings.Split(in, "_")
	for i := range tokens {
		tokens[i] = strings.Title(strings.Trim(tokens[i], " "))
	}
	return strings.Join(tokens, "")
}
999799
func EnvStyle(s string) string {
	return envStyleRegexp.ReplaceAllStringFunc(s, func(s string) string {
		return "$" + strings.ToUpper(s[1:len(s)-1])
	})
}
8719
func toSnakeCase(name string) (hyphenated string) {
	snakeMemoizer.Lock()
	defer snakeMemoizer.Unlock()
	if hyphenated = snakeMemoizer.memo[name]; hyphenated != "" {
		return hyphenated
	}
	hyphenated = name
	for _, converter := range snakeConverters {
		hyphenated = converter.re.ReplaceAllString(hyphenated, converter.repl)
	}
	hyphenated = strings.ToLower(hyphenated)
	snakeMemoizer.memo[name] = hyphenated
	return
}
747317
func Capitalize(s1 string) string {
	s2 := strings.ToLower(s1)
	return ToUpperFirst(s2)
}
354212
func UnderscoreToCamelCase(s string) string {
	return strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), "_", " ", -1)), " ", "", -1)
}
734070
func CaseInsensitive(tokens ...string) Option {
	return func(p *Parser) error {
		for _, token := range tokens {
			p.caseInsensitive[token] = true
		}
		return nil
	}
}