代码拉取完成,页面将自动刷新
package goutil
import (
"fmt"
"math/rand"
"strconv"
"time"
)
func SayHello() {
fmt.Println("hello qzp")
}
func FindType(i interface{}) {
switch x := i.(type) {
case int:
fmt.Println(x, "is int")
case string:
fmt.Println(x, "is string")
case nil:
fmt.Println(x, "is nil")
default:
fmt.Println(x, "not type matched")
}
}
func MyPrintf(args ...interface{}) {
for _, arg := range args {
switch arg.(type) {
case int:
fmt.Println(arg, "is an int value.")
case string:
fmt.Println(arg, "is a string value.")
case int64:
fmt.Println(arg, "is an int64 value.")
default:
fmt.Println(arg, "is an unknown type.")
}
}
}
func GetRandomWelcome() {
sWelcomeList := []string{"come on qzp", "happy everyday qzp", "take easy qzp", "you are best qzp", "relax yourself qzp", "please laugh haha qzp"}
iWelcomeListLen := len(sWelcomeList)
// for idx := 0; idx < sWelcomeLen; idx++ {
// fmt.Println(sWelcomeList[idx])
// }
t := time.Now()
dateFmt := t.Format("2006-01-02 15:04:05") //go诞生的时间
logStr := "[当前的时间是:" + dateFmt + "]" + "欢迎语长度为" + strconv.Itoa(iWelcomeListLen) + ",欢迎语为"
rand.Seed(time.Now().UnixNano())
iRandNum := rand.Intn(iWelcomeListLen)
logStr += sWelcomeList[iRandNum]
fmt.Println(logStr)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。