Go 语言中检测空字符串的最优方法
以下两种风格在 Go 的标准库源码中皆可找到:
if len(s) > 0 { ... }
可以在 strconv
包里找到 —— http://golang.org/src/pkg/strconv/atoi.go
if s != "" { ... }
可以在 encoding/json
包里找到 —— http://golang.org/src/pkg/encoding/json/en...
以下两种风格在 Go 的标准库源码中皆可找到:
if len(s) > 0 { ... }
可以在 strconv
包里找到 —— http://golang.org/src/pkg/strconv/atoi.go
if s != "" { ... }
可以在 encoding/json
包里找到 —— http://golang.org/src/pkg/encoding/json/en...
粤ICP备18099781号-6
|
粤公网安备 44030502004330号
|
违法和不良信息举报
由 Summer 设计和编码 ❤
推荐文章: