摘要: 结构体生成Json package main import ( "encoding/json" "fmt" ) type IT struct { Company string `json:"-"` //此字段不会输出到屏幕 //Company string `json:"company"` 这样打印 阅读全文
posted @ 2018-09-14 22:56 温柔的风 阅读(8961) 评论(0) 推荐(0) 编辑
摘要: package main import "fmt" type Person struct { name string //名字 sex byte //性别 age int //年龄 } type Student struct { Person //只有类型,没有名字,匿名字段,继承了Person的成员 id int ad... 阅读全文
posted @ 2018-09-14 14:49 温柔的风 阅读(199) 评论(0) 推荐(0) 编辑
摘要: package main import ( "strconv" "fmt" ) func main() { // 使用ParseFloat解析浮点数,64是说明使用多少位 // 精度来解析 f, _ := strconv.ParseFloat("1.234", 64) fmt.Println(f) // 对于ParseInt函数,0 表示... 阅读全文
posted @ 2018-09-14 11:59 温柔的风 阅读(15552) 评论(0) 推荐(0) 编辑