diff --git a/g/util/gconv/gconv.go b/g/util/gconv/gconv.go index 36b0bf678..29ccfb8b8 100644 --- a/g/util/gconv/gconv.go +++ b/g/util/gconv/gconv.go @@ -123,8 +123,7 @@ func Int(i interface{}) int { } return 0 default: - v, _ := strconv.Atoi(strings.TrimSpace(String(value))) - return v + return int(Float64(value)) } } @@ -211,8 +210,7 @@ func Uint(i interface{}) uint { } return 0 default: - v, _ := strconv.ParseUint(strings.TrimSpace(String(value)), 10, 64) - return uint(v) + return uint(Float64(value)) } } diff --git a/geg/other/test.go b/geg/other/test.go index 0547cc693..a0577e76a 100644 --- a/geg/other/test.go +++ b/geg/other/test.go @@ -1,13 +1,14 @@ package main import ( - "fmt" - "strings" + "gitee.com/johng/gf/g" + "gitee.com/johng/gf/g/net/ghttp" ) func main() { - fmt.Println(strings.Trim(` 1 `, "./- \n\r")) - //fmt.Println(math.MaxInt64) - //fmt.Println(gtime.Second()) - //fmt.Println(gtime.Nanosecond()) + g.Server().BindHandler("/", func(r *ghttp.Request) { + r.Response.Write(r.GetInt("amount")) + }) + g.Server().SetPort(8199) + g.Server().Run() } \ No newline at end of file diff --git a/geg/other/test2.go b/geg/other/test2.go index 488908146..b3e410bf2 100644 --- a/geg/other/test2.go +++ b/geg/other/test2.go @@ -2,12 +2,10 @@ package main import ( "fmt" - "gitee.com/johng/gf/g/container/garray" + "gitee.com/johng/gf/g/util/gconv" ) func main() { - a := garray.NewSortedIntArray(0) - a.Add(1) - a.Remove(0) - fmt.Println(a.Len()) + fmt.Println(int(gconv.Float64("2.99s"))) + //fmt.Println(strconv.Atoi(strings.TrimSpace("1.99"))) } \ No newline at end of file