摘要: ```go package main import ( "fmt" "math" ) const da = 0.29999999999999998889776975374843459576368331909180 const db = 0.3 func main() { daStr := fmt.S 阅读全文
posted @ 2018-03-21 23:59 cucy_to 阅读(126) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "strconv" ) const bin = "00001" const hex = "2f" const intString = "12" const floatString = "12.3" func main() { // Decimals res, err := strconv.Atoi(intStrin... 阅读全文
posted @ 2018-03-21 23:56 cucy_to 阅读(289) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "strconv" "strings" "unicode" ) func main() { text := "Hi! Go is awesome." text = Indent(text, 6) fmt.Println(text) text = Unindent(text, 3) fmt.Println... 阅读全文
posted @ 2018-03-21 23:53 cucy_to 阅读(106) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "math" "regexp" "strconv" "strings" ) func main() { stringToTrim := "\t\t\n Go \tis\t Awesome \t\t" trimResult := strings.TrimSpace(stringToTrim) fmt.Pr... 阅读全文
posted @ 2018-03-21 23:52 cucy_to 阅读(140) 评论(0) 推荐(0)
摘要: data.csv un_comment.csv 阅读全文
posted @ 2018-03-21 23:50 cucy_to 阅读(102) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "strings" "unicode" ) const email = "ExamPle@domain.com" const name = "isaac newton" const upc = "upc" const i = "i" const snakeCase = "first_name" func main(... 阅读全文
posted @ 2018-03-21 23:44 cucy_to 阅读(139) 评论(0) 推荐(0)
摘要: cat /Users/zrd/Downloads/gostandardlib/Chapter02/Strings\ and\ Things/recipe08/win1250.txt Gda�sk% decode 阅读全文
posted @ 2018-03-21 23:43 cucy_to 阅读(84) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "regexp" ) const refString = `[{ \"email\": \"email@example.com\" \"phone\": 555467890}, { \"email\": \"other@domain 阅读全文
posted @ 2018-03-21 23:24 cucy_to 阅读(104) 评论(0) 推荐(0)
摘要: 正则替换 阅读全文
posted @ 2018-03-21 23:21 cucy_to 阅读(101) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "os" "text/tabwriter" ) func main() { w := tabwriter.NewWriter(os.Stdout, 15, 0, 1, ' ', tabwriter.AlignRight) fmt.Fprintln(w, "username\tfirstname\tlastname\... 阅读全文
posted @ 2018-03-21 23:17 cucy_to 阅读(191) 评论(0) 推荐(0)
摘要: 性能测试 go package bench import ( "bytes" "testing" ) const testString = "test" func BenchmarkConcat(b testing.B) { var str string b.ResetTimer() for n : 阅读全文
posted @ 2018-03-21 23:05 cucy_to 阅读(113) 评论(0) 推荐(0)
摘要: ## ```go package main import ( "fmt" "strings" ) const selectBase = "SELECT * FROM user WHERE %s " var refStringSlice = []string{ " FIRST_NAME = 'Jack' ", " INSURANCE_NO = 333444555 ", " EFFEC... 阅读全文
posted @ 2018-03-21 22:48 cucy_to 阅读(96) 评论(0) 推荐(0)
摘要: 遍历带空格的字符串 指定分割的字符串 去除特别符号 正则去掉特别字符串 阅读全文
posted @ 2018-03-21 22:34 cucy_to 阅读(117) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "strings" ) const refString = "Mary had a little lamb" func main() { lookFor := "lamb" contain := strings.Contains(refString, lookFor) fmt.Printf("The \"%s\"... 阅读全文
posted @ 2018-03-21 22:22 cucy_to 阅读(103) 评论(0) 推荐(0)
摘要: 数据存储 存储在内存中 读写文件 CSV gob 二进制文件 阅读全文
posted @ 2018-03-21 19:14 cucy_to 阅读(138) 评论(0) 推荐(0)
摘要: 模板引擎 无逻辑模板引擎, 嵌入逻辑模板引擎 简单的模板 goweb模板引擎需要两个步骤,1对文本的模板源进行语法分析,创建一个经过语法分析的模板结构,其中模板源可以是一个字符串,也可以是模板文件包含的内容;(2)经过执行语法分析的模板,将ResponseWriter和模板所需的动态数据传给模板引擎 阅读全文
posted @ 2018-03-21 16:07 cucy_to 阅读(658) 评论(0) 推荐(0)
摘要: Request 结构 组成: URL字段 Header字段 空行 Body字段 Form字段、postform字段,multipartForm字段 请求Url ·结构· URL格式一般为 request Header request Body Form POST FILE 方法2 response 阅读全文
posted @ 2018-03-21 10:46 cucy_to 阅读(131) 评论(0) 推荐(0)