// simplifyName converts a name to lower case and removes non-alphanumeric characters.
// This is how the names are used as keys to the maps.
333682
func simplifyName(name string) string {
	var buf bytes.Buffer
	for _, c := range name {
		switch {
		case unicode.IsDigit(c):
			buf.WriteRune(c)
		case unicode.IsLetter(c):
			buf.WriteRune(unicode.ToLower(c))
		default:

		}
	}

	return buf.String()
}
1014103
func (p *printer) shorten(name string) string {
	name = strings.TrimPrefix(name, ".")
	if p.file.GetPackage() != "" {
		name = strings.TrimPrefix(name, p.file.GetPackage()+".")
	}
	return name
}
28916
func (m Map) Names() []string {
	ret := make([]string, len(m.nameMap))
	i := 0
	for name := range m.nameMap {
		ret[i] = name
		i++
	}
	return ret
}
449893
func sanitizeName(name string) string {
	output := strings.ToLower(illegalChars.ReplaceAllString(name, "_"))

	if legalLabel.MatchString(output) {
		return output
	}
	// Prefix name with _ if it begins with a number
	return "_" + output
}
200791
func cleanName(name string) string {
	ret := strings.ToLower(name)
	if pos := strings.Index(ret, " "); pos != -1 {
		ret = ret[:pos]
	}
	return ret
}
302752
func (s *XPackSecurityPutRoleMappingService) Name(name string) *XPackSecurityPutRoleMappingService {
	s.name = name
	return s
}
644389
func randomizeName(name string) string {
	return strings.Join([]string{
		name,
		fmt.Sprintf("%08x", rand.Uint32()),
	}, nameDelimiter)
}
1215475
func ToJSONName(name string) string {
	in := split(name)
	out := make([]string, 0, len(in))

	for i, w := range in {
		if i == 0 {
			out = append(out, lower(w))
			continue
		}
		out = append(out, Camelize(w))
	}
	return strings.Join(out, "")
}
376220
func (m *ChannelMap) PrettyName() (string, error) {
	cstr := C.pa_channel_map_to_pretty_name(m.toC())
	if cstr == nil {
		return "", errors.New("No name found for channel mapping.")
	}
	return C.GoString(cstr), nil
}
650606
func (a *API) NiceName() string {
	if a.Metadata.ServiceAbbreviation != "" {
		return a.Metadata.ServiceAbbreviation
	}
	return a.Metadata.ServiceFullName
}
838262
func (a *API) ExportableName(name string) string {
	if name == "" {
		return name
	}

	return strings.ToUpper(name[0:1]) + name[1:]
}
640911
func (l byName) Less(i, j int) bool {
	return strings.ToLower(l.Items[i].Name) < strings.ToLower(l.Items[j].Name)
}
831120
func (u *Unit) Name() string {
	u.mu.Lock()
	defer u.mu.Unlock()
	return u.details.Name
}
201914
func Name(s string) string {
	// Start with lowercase string
	fileName := strings.ToLower(s)
	fileName = path.Clean(path.Base(fileName))

	// Remove illegal characters for names, replacing some common separators with -
	fileName = cleanString(fileName, illegalName)

	// NB this may be of length 0, caller must check
	return fileName
}
37831
func (e *Elem) Name() string {
	if e.name != "" {
		return e.name
	}
	for _, rrs := range e.m {
		e.name = rrs[0].Header().Name
		return e.name
	}
	return ""
}
753062
func BaseName(s string) string {

	// Replace certain joining characters with a dash
	baseName := baseNameSeparators.ReplaceAllString(s, "-")

	// Remove illegal characters for names, replacing some common separators with -
	baseName = cleanString(baseName, illegalName)

	// NB this may be of length 0, caller must check
	return baseName
}
1324802
func LowerCaseWithUnderscores(name string) string {
	newName := []rune{}
	for i, c := range name {
		if i == 0 {
			newName = append(newName, unicode.ToLower(c))
		} else {
			if unicode.IsUpper(c) {
				newName = append(newName, '_')
				newName = append(newName, unicode.ToLower(c))
			} else {
				newName = append(newName, c)
			}
		}
	}
	return string(newName)
}