From 6b7c8152f0eeb7850aab0e2b6bc1c983b0a22aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Fri, 29 Apr 2022 14:05:40 +0800 Subject: [PATCH] add ToString --- gostring.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gostring.go b/gostring.go index daea728..587dea1 100644 --- a/gostring.go +++ b/gostring.go @@ -4,11 +4,22 @@ import ( "crypto/hmac" "crypto/sha256" "encoding/hex" + "fmt" "strconv" "strings" "unicode/utf8" ) +const Version = "1.0.1" + +// ToString 转换成string +func ToString(value interface{}) string { + if value == nil { + return "" + } + return fmt.Sprint(value) +} + // ToFloat64 string到float64 func ToFloat64(s string) float64 { i, _ := strconv.ParseFloat(s, 64)