This commit is contained in:
邹宗楠
2022-10-06 17:02:05 +08:00
parent fe2adc643f
commit 54432e868c
2 changed files with 8 additions and 0 deletions

View File

@@ -210,3 +210,7 @@ func TestCreateStoreCommodity(t *testing.T) {
fmt.Println("err=============", err) fmt.Println("err=============", err)
fmt.Println("data===", fmt.Sprintf("%v", data)) fmt.Println("data===", fmt.Sprintf("%v", data))
} }
func TestInt16(t *testing.T) {
fmt.Println(utils.Str2Int16(strings.ReplaceAll("08:00", ":", "")))
}

View File

@@ -565,6 +565,10 @@ func Str2Int(s string) (i int) {
return int(Str2Int64WithDefault(s, 0)) return int(Str2Int64WithDefault(s, 0))
} }
func Str2Int16(s string) (i int16) {
return int16(Str2Int64WithDefault(s, 0))
}
//func String2Int64Slice(s string) []int64 { //func String2Int64Slice(s string) []int64 {
// res := make([]int64, 0) // res := make([]int64, 0)
// if len(s) == 0 { // if len(s) == 0 {