parse.go 231 B

12345678910111213
  1. package utils
  2. import (
  3. "fmt"
  4. "strconv"
  5. )
  6. func IntToDecimal(num int32) (float64, error) {
  7. floatString := fmt.Sprintf("%.2f", float64(num)/float64(100))
  8. result, err := strconv.ParseFloat(floatString, 64)
  9. return result, err
  10. }