gitlab.com/evatix-go/core@v1.3.55/coreutils/stringutil/ToInt16.go (about) 1 package stringutil 2 3 import "strconv" 4 5 func ToInt16( 6 s string, 7 defVal int16, 8 ) int16 { 9 toInt, err := strconv.Atoi(s) 10 11 if err != nil { 12 return defVal 13 } 14 15 return int16(toInt) 16 }