// extractKindName from agtzfnN0Zy1jaGFvc3JACxIcX0FFX0RhdGFzdG9yZUFkbWluX09wZXJhdGlvbhjx52oMCxIWX0FFX0JhY2t1cF9JbmZvcm1hdGlvbhgBDA.Article.backup_info like ID value.
177415
func (obj *GCSObject) extractKindNameForDatastoreAdmin(name string) string {
	if v := strings.LastIndex(name, "/"); v != -1 {
		name = name[v:]
	}
	vs := strings.Split(name, ".")
	if len(vs) != 3 {
		return ""
	}
	if vs[2] != "backup_info" {
		return ""
	}
	return vs[1]
}
759848
func Name(name string) (should string) {
	should = lint.Name(name)

	for _, replace := range []struct {
		re *regexp.Regexp
		to string
	}{
		{re: reIDs, to: "IDs"},
		{re: reURLs, to: "URLs"},
		{re: reIDRef, to: "IDRef"},
	} {
		should = replace.re.ReplaceAllString(should, fmt.Sprintf("${1}%s${2}", replace.to))
	}

	return should
}
649570
func (self *Collection) GetIndexName() string {
	if self.IndexName != `` {
		return self.IndexName
	}

	return self.Name
}
790721
func GetFieldKind(obj interface{}, name string) (reflect.Kind, error) {
	field, err := getInnerField(obj, name)
	if err != nil {
		return reflect.Invalid, err
	}

	return field.Kind(), nil
}
299470
func (formats Formats) GetByName(name string) (f Format, found bool) {
	for _, ff := range formats {
		if strings.EqualFold(name, ff.Name) {
			f = ff
			found = true
			return
		}
	}
	return
}
628015
func newAEBackupKindQueryBuilderWithKind(kind string) *aeBackupKindQueryBuilder {
	q := datastore.NewQuery(kind)
	bldr := &aeBackupKindQueryBuilder{q: q}
	bldr.Kind = &aeBackupKindQueryProperty{
		bldr: bldr,
		name: "Kind",
	}
	bldr.ID = &aeBackupKindQueryProperty{
		bldr: bldr,
		name: "__key__",
	}

	if plugger, ok := interface{}(bldr).(Plugger); ok {
		bldr.plugin = plugger.Plugin()
		bldr.plugin.Init("AEBackupKind")
	}

	return bldr
}
625218
func (v *StorageVol) GetName() (string, error) {
	var err C.virError
	name := C.virStorageVolGetNameWrapper(v.ptr, &err)
	if name == nil {
		return "", makeError(&err)
	}
	return C.GoString(name), nil
}
1129783
func extractBucket(id string) string {
	if !strings.HasPrefix(id, "buildbucket/") {
		return ""
	}
	toks := strings.SplitN(id, "/", 3)
	if len(toks) != 3 {
		return ""
	}
	return toks[1]
}
539377
func ParseKind(s string) Kind {
	s = strings.ToLower(s)
	switch s {
	case "view":
		return KindView
	case "active":
		return KindActive
	case "committed":
		return KindCommitted
	}

	return KindUnknown
}
1103240
func (f *Fn) HelperName() string {
	if !f.HasStringParam() {
		return f.Name
	}
	return "_" + f.Name
}
824517
func InsertName(tname string, i interface{}) {
	t := reflect.ValueOf(i).Type()
	if _, found := typemap[tname]; !found {
		typemap[tname] = t
	}
}
22950
func extractIDFromPath(url string) (string, error) {
	result := reExtractFileID.FindStringSubmatch(url)
	if len(result) != 2 {
		return "", ErrNotFound
	}
	return result[1], nil
}
734747
func getAttachmentName(volName, csiDriverName, nodeName string) string {
	result := sha256.Sum256([]byte(fmt.Sprintf("%s%s%s", volName, csiDriverName, nodeName)))
	return fmt.Sprintf("csi-%x", result)
}
282050
func ExtractUserLocalpart(userID string) (string, error) {
	if len(userID) == 0 || userID[0] != '@' {
		return "", fmt.Errorf("%s is not a valid user id", userID)
	}
	return strings.TrimPrefix(
		strings.SplitN(userID, ":", 2)[0], // @foo:bar:8448 => [ "@foo", "bar:8448" ]
		"@", // remove "@" prefix
	), nil
}
1102019
func typeName(item mo.Reference) string {
	return reflect.TypeOf(item).Elem().Name()
}
475507
func (obj *GCSObject) extractKindNameForDatastoreExport(name string) string {
	if v := strings.LastIndex(name, "."); v != -1 {
		if name[v:] != ".export_metadata" {
			return ""
		}
	} else {
		// The expected value is the value of ".export_metadata" at the end, so exclude if there is no.
		return ""
	}

	if v := strings.LastIndex(name, "/"); v != -1 {
		name = name[:v]
	}
	if v := strings.LastIndex(name, "/"); v != -1 {
		name = name[v:]
	}

	return name[len("/kind_"):]
}
682473
func extractTypeName(tip string) string {
	// trim all spaces
	tip = strings.TrimSpace(tip)

	// detect array
	if strings.Index(tip, "]") < 0 {
		return tip
	}

	// find type inside square bracket
	inBracket := reSquareBracket.FindString(tip)
	if inBracket == "" {
		return tip
	}
	last := strings.LastIndex(inBracket, "[")
	inBracket = inBracket[last+1:]
	return strings.TrimSuffix(inBracket, "]")
}