MCPcopy
hub / github.com/fish2018/pansou / StringToInt

Function StringToInt

util/convert.go:8–18  ·  view source on GitHub ↗

StringToInt 将字符串转换为整数,如果转换失败则返回0

(s string)

Source from the content-addressed store, hash-verified

6
7// StringToInt 将字符串转换为整数,如果转换失败则返回0
8func StringToInt(s string) int {
9 if s == "" {
10 return 0
11 }
12
13 i, err := strconv.Atoi(s)
14 if err != nil {
15 return 0
16 }
17 return i
18}

Callers 1

SearchHandlerFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected