// PropertyString type asserts a property to `string`.
973245
func (f *Feature) PropertyString(key string) (string, error) {
	if s, ok := (f.Properties[key]).(string); ok {
		return s, nil
	}
	return "", fmt.Errorf("type assertion of `%s` to string failed", key)
}
1334559
func (c *JSONConfigContainer) DefaultString(key string, defaultval string) string {
	// TODO FIXME should not use "" to replace non existence
	if v := c.String(key); v != "" {
		return v
	}
	return defaultval
}
1269321
func cmdFieldTypeString(t design.DataType, point bool) string {
	var pointer, suffix string
	if point && !t.IsArray() {
		pointer = "*"
	}
	if t.Kind() == design.UUIDKind || t.Kind() == design.DateTimeKind || t.Kind() == design.AnyKind || t.Kind() == design.NumberKind || t.Kind() == design.BooleanKind {
		suffix = "string"
	} else if isArrayOfType(t, design.UUIDKind, design.DateTimeKind, design.AnyKind, design.NumberKind, design.BooleanKind) {
		suffix = "[]string"
	} else {
		suffix = codegen.GoNativeType(t)
	}
	return pointer + suffix
}
1032687
func DataToString(i interface{}) string {
	switch v := i.(type) {
	case string:
		return v
	case fmt.Stringer:
		return v.String()
	case uint8, int8, uint16, int16, uint32, int32, uint64, int64, int, uint:
		return fmt.Sprintf("%d", v)
	case []byte:
		return string(v)
	default:
		panic("unknown type")
	}
}
1204022
func (reg *typeRegistry) IsStringType(t *Type) bool {
	return reg.BaseType(t) == BaseTypeString
}
831342
func (tag Tag) ToString() string {
	return fmt.Sprintf("{ Code: %v; Value: %v }", tag.Code, tag.Value.ToString())
}
1024765
func (v *Value) ToString() (val string, ok bool) {
	switch v.vType {
	case typeString:
		val, ok = v.value.(string)
	default:
	}
	return
}
606955
func (c ConfigEntryResult) String() string {
	return fmt.Sprintf("%s=\"%s\"", c.Name, c.Value)
}
394859
func (formatter *Formatter) ToString(data interface{}) string {
	if str, ok := data.(string); ok {
		return str
	}

	if byteSlice, ok := data.([]byte); ok {
		return string(byteSlice)
	}

	return fmt.Sprintf("%v", data)
}
441780
func variablesStr(vs []*Variable) string {
	result := ""
	ks := make([]string, 0, len(vs))
	m := make(map[string]*Variable)
	for _, v := range vs {
		ks = append(ks, v.Name)
		m[v.Name] = v
	}
	sort.Strings(ks)

	for _, k := range ks {
		v := m[k]

		required := ""
		if v.Required() {
			required = " (required)"
		}

		declaredType := ""
		if v.DeclaredType != "" {
			declaredType = fmt.Sprintf(" (%s)", v.DeclaredType)
		}

		if v.Default == nil || v.Default == "" {
			v.Default = "<>"
		}
		if v.Description == "" {
			v.Description = "<>"
		}

		result += fmt.Sprintf(
			"%s%s%s\n  %v\n  %s\n",
			k,
			required,
			declaredType,
			v.Default,
			v.Description)
	}

	return strings.TrimSpace(result)
}
1194634
func (v *VARIANT) ToString() string {
	if v.VT != VT_BSTR {
		return ""
	}
	return BstrToString(*(**uint16)(unsafe.Pointer(&v.Val)))
}
1362429
func (feature *Feature) PropertyStringSlice(propertyName string) []string {
	var result []string
	if property, ok := feature.Properties[propertyName]; ok {
		switch ptype := property.(type) {
		case []string:
			result = ptype
		case []interface{}:
			for _, curr := range ptype {
				if currString, ok := curr.(string); ok {
					result = append(result, currString)
				}
			}
		}
	}
	return result
}
1301562
func (s *IndicesShrinkService) BodyString(body string) *IndicesShrinkService {
	s.bodyString = body
	return s
}
1100613
func (v *Variable) TypeString() string {
	if v == nilVariable {
		return "nil"
	}
	if v.DwarfType != nil {
		return v.DwarfType.Common().Name
	}
	return v.Kind.String()
}
1020395
func ToString(i interface{}) string {
	switch t := i.(type) {
	case nil:
		return ""
	case []byte:
		return string(t)
	case string:
		return t
	case *string:
		return *t
	case bool:
		return strconv.FormatBool(t)
	case float32:
		return strconv.FormatFloat(float64(t), 'f', -1, 32)
	case float64:
		return strconv.FormatFloat(t, 'f', -1, 64)
	case int:
		return strconv.Itoa(t)
	case int32:
		return strconv.FormatInt(int64(t), 10)
	case int64:
		return strconv.FormatInt(t, 10)
	case template.HTML:
		return string(t)
	case template.URL:
		return string(t)
	case fmt.Stringer:
		return t.String()
	case error:
		return t.Error()
	default:
		return fmt.Sprint(i)
	}
}
981704
func GetTypeByString(typeName string) (ServiceType, error) {
	switch ServiceType(typeName) {
	case HTTP:
		return HTTP, nil
	case HTTPS:
		return HTTPS, nil
	case TCP:
		return TCP, nil
	case UDP:
		return UDP, nil
	case Custom:
		return Custom, nil
	default:
		return ServiceType(typeName), ErrServiceTypeNotFound
	}
}
1152328
func (t Type) String() string {
	return fmt.Sprintf("Type{%v %q %T %v}", t.Kind, t.Pkg, t.Node, pretty{t.Node})
}