摘要: 1.if /else分支判断 1.if condition { } 2.if condition { }else { } 3.if condition { }else if condition { }else { } 2.switch / case var i =0 switch i { case 阅读全文
posted @ 2020-03-26 12:47 kakawith 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 1.声明语法 func 函数名 (参数列表) (返回值) { pass } 1.func add() { pass } 2.func add(a int, b int) (int,int) { pass } 3.func add(a,b int,args...) int { pass } 4.匿名函 阅读全文
posted @ 2020-03-26 12:43 kakawith 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 1.time.Time类型,用来表示时间 2.获取当前时间 now := time.Now() now := time.Now().Day() now := time.Now().Minute() now := time.Now().Month() now := time.Now().Year() 阅读全文
posted @ 2020-03-26 11:34 kakawith 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 一、strings包 1.strings.HasPrefix() strings.HasPrefix(s string, "prefix" string) bool 判断字符串s是否是以‘prefix’开头,返回值为bool类型 2.strings.HasSuffix() strings.HasSu 阅读全文
posted @ 2020-03-26 11:19 kakawith 阅读(208) 评论(0) 推荐(0) 编辑