gitlab.com/evatix-go/core@v1.3.55/coreutils/stringutil/ToInt32.go (about)

     1  package stringutil
     2  
     3  import "strconv"
     4  
     5  func ToInt32(
     6  	s string,
     7  	defVal int32,
     8  ) int32 {
     9  	toInt, err := strconv.Atoi(s)
    10  
    11  	if err != nil {
    12  		return defVal
    13  	}
    14  
    15  	return int32(toInt)
    16  }