【文件属性】:
文件名称:typeconverter:基本 go 类型之间的转换,如 int、float、string、time.Time、json、xml
文件大小:15KB
文件格式:ZIP
更新时间:2021-06-13 01:48:32
Go
类型转换器
以下 go 类型之间的转换(可以添加您自己的类型):
整数
布尔值
浮动32
浮动64
*时间.时间
弦/纵梁
json
xml
[]界面{}
地图[字符串]接口{}
例子
对于主要类型,您可以简单地使用 Convert()
package main
import (
"fmt"
conv "github.com/metakeule/typeconverter"
"time"
)
func main () {
var s string
// convert time to string
t1 , _ := time . Parse ( time . RFC3339 , "2011-01-26T18:53:18+01:00" )
conv . Convert ( t1 , & s )
fmt . Println ( s ) // 2011-01-
【文件预览】:
typeconverter-master
----time.go(749B)
----typeconverter.go(4KB)
----xml.go(2KB)
----.gitignore(252B)
----README.md(1KB)
----typeconverter_test.go(8KB)
----default.go(700B)
----json.go(2KB)
----int.go(1KB)
----doc.go(1KB)
----map.go(539B)
----examples()
--------type()
--------simple()
--------overwrite()
--------simple2()
----LICENSE(1KB)
----float.go(2KB)
----.travis.yml(13B)
----string.go(2KB)
----array.go(651B)
----bool.go(519B)