// FormInt returns request form as int with default
173302
func (ctx *Context) FormInt(key string, defaults ...int) int {
	return (*Forms)(ctx.req).MustInt(key, defaults...)
}
635540
func (v Version) SubInt() (int, bool) {
	result, err := strconv.Atoi(v.Sub())
	return result, err == nil
}
736249
func Int(name string, out *int, predicates ...Predicate) Param {
	return func(r *http.Request) error {
		v := r.Form.Get(name)
		for _, p := range predicates {
			if err := p.Pass(name, r); err != nil {
				return err
			}
		}
		if v == "" {
			return nil
		}
		p, err := strconv.Atoi(v)
		if err != nil {
			return &BadParameterError{Param: name, Message: err.Error()}
		}
		*out = p
		return nil
	}
}
729306
func (c *Context) QueryIntWithDefault(key string, defaultValue int) (int, error) {
	data := c.Query(key)
	if len(data) > 0 {
		return strconv.Atoi(c.Query(key))
	}
	return defaultValue, nil
}
1156516
func (formlet Formlet) Rate(rate int8) Input {
	CheckRate(rate)
	if formlet.In == nil {
		panic("Formlet expects In to not be nil")
	}
	(&formlet).defaults()
	return NewInput("Formlet", rate, 0, 1, formlet.In, formlet.Freq, formlet.AttackTime, formlet.DecayTime)
}
338417
func (accounting *Accounting) FormatMoneyInt(value int) string {
	if !accounting.isInitialized {
		accounting.init()
	}
	formattedNumber := FormatNumberInt(value, accounting.Precision, accounting.Thousand, accounting.Decimal)
	return accounting.formatMoneyString(formattedNumber)
}
482296
func (c *Context) QueryInt(key string) (int, error) {
	return strconv.Atoi(c.Query(key))
}
1369026
func (context *BaseContext) GetInt(
	key string, defaultValue ...int) int {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(int); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return 0
}
1206149
func (context *BaseContext) SetInt(key string, value int) {
	context.userData[key] = value
}
6499
func (p *PortList) PopInt() int {
	i, err := strconv.Atoi(p.Pop())
	if err != nil {
		panic(err)
	}
	return i
}
172440
func (v *Validator) TypeInt(field string) *ValidationResult {
	if _, err := strconv.Atoi(v.data.Get(field)); err != nil {
		return v.addTypeError(field, "integer")
	} else {
		return validationOk
	}
}
1226287
func (c *Context) GlobalInt(name string) int {
	if fs := lookupGlobalFlagSet(name, c); fs != nil {
		return lookupInt(name, fs)
	}
	return 0
}
957702
func (ini *INI) GetInt(key string) (int, bool) {
    return ini.SectionGetInt(DefaultSection, key)
}
502368
func TryToInt(i interface{}) (r int, err error) {
	switch t := i.(type) {
	case nil:
		r = 0
	case int:
		r = t
	case *int:
		r = *t
	case int8:
		r = int(t)
	case int16:
		r = int(t)
	case int32:
		r = int(t)
	case int64:
		r = int(t)
	case uint:
		r = int(t)
	case uint8:
		r = int(t)
	case uint16:
		r = int(t)
	case uint32:
		r = int(t)
	case uint64:
		r = int(t)
	case float32:
		r = int(t)
	case float64:
		r = int(t)
	case bool:
		if t {
			r = 1
		}
	case string:
		r, err = strconv.Atoi(t)
	default:
		err = castError(i, "int")
	}
	return
}
421500
func MustInt(s string, defaultVal ...int) int {
	getDefault := func() int {
		if len(defaultVal) > 0 {
			return defaultVal[0]
		}
		return 0
	}

	if s == "" {
		return getDefault()
	}

	i, err := strconv.Atoi(strings.TrimSpace(s))
	if err != nil {
		msg := "goutils MustInt strconv.Atoi error:" + err.Error()
		// 加上文件调用和行号
		_, callerFile, line, ok := runtime.Caller(1)
		if ok {
			msg += fmt.Sprintf("file:%s,line:%d", callerFile, line)
		}
		log.Println(msg)
		return getDefault()
	}

	return i
}
683709
func GetInt(r *http.Request, name string, value int) int {
	v := r.FormValue(name)
	if i, err := strconv.Atoi(v); err == nil {
		return i
	}
	return value
}
385649
func validateInt(v string) error {
	if v == "" {
		return nil
	}
	_, err := strconv.Atoi(v)
	return err
}