Files
pansou/util/convert.go
fish2018 5004e4f99f update
2025-07-12 19:53:44 +08:00

18 lines
244 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package util
import (
"strconv"
)
// StringToInt 将字符串转换为整数如果转换失败则返回0
func StringToInt(s string) int {
if s == "" {
return 0
}
i, err := strconv.Atoi(s)
if err != nil {
return 0
}
return i
}