golang 类型转换
发表于|更新于|golang
|浏览量:
转换为 字符串
如果强制类型转换失败
可以使用strconv包
1 | strconv.FormatBool(bool) |
即可将bool转为str
文章作者: developer
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Dev!
相关推荐
2019-03-01
golang 时间 格式化
go格式化时间必须使用6-1-2-3-4-5这个时间点 时间戳1fmt.Println(time.Now().Unix()) 格式化1fmt.Println(time.Now().Format("2006-01-02 15:04:05")) 时间戳格式化1time.Unix(1389058332, 0).Format("2006-01-02 15:04:05") 时间解析1234the_time, err := time.Parse("2006-01-02 15:04:05", "2014-01-08 09:04:41")if err == nil { unix_time := the_time.Unix()} 其他操作12the_time := time.Date(2014, 1, 7, 5, 50, 4, 0, time.Local)unix_time := the_time.Unix()
2019-09-30
golang 静态编译 sqlite
需要安装mingw-w64-install不是Cygwin64 Terminal
2019-05-20
golang 编译 去掉 windows 黑框
1go build -ldflags="-H windowsgui" -o webview-example.exe
2019-10-02
golang 腾讯云 cos 上传文件 刷新 cdn
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990package mainimport ( "context" "fmt" "net/url" "os" "strings" cdn "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" "github.com/tencentcloud/tencentcloud-sdk-go/t...
2021-01-27
golang 注意点
引用slice、map、channel 是引用类型,而不是引用传递https://blog.csdn.net/ljlinjiu/article/details/88852863
2019-03-04
golang 导入包
点操作有时候会看到如下的方式导入包 1import( . "fmt" ) 这个点操作的含义就是这个包导入之后在你调用这个包的函数时,你可以省略前缀的包名,也就是前面你调用的fmt.Println(“hello world”) 可以省略的写成Println(“hello world”) 别名操作12import( f "fmt" )f.Println("hello world") _操作说明只是为了执行包中的init函数
公告
This is my Blog