摘要: 格式化日期时间 第一种方式: fmt.Sprintf() 函数 now := time.Now() fmt.Printf("now-> %v, type-> %T\n", now, now) // now-> 2021-08-30 21:59:14.679666 +0800 CST m=+0.000 阅读全文
posted @ 2021-08-30 22:09 小皮浩 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 字符串 常用的系统函数 1、统计字符串的长度,按字节len(str) // golang的编码统一为utf-8(ASCII的字符(字母和数字)占一个字节,中文占3个字节) var str = "xiao浩" fmt.Println(len(str)) 2、字符串遍历,同时处理有中文的问题 // 方式 阅读全文
posted @ 2021-08-30 21:30 小皮浩 阅读(176) 评论(0) 推荐(0) 编辑