上一页 1 ··· 5 6 7 8 9 10 11 12 下一页

2018年3月21日

3.2

摘要: ```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 阅读(118) 评论(0) 推荐(0) 编辑

3.1 二进制,浮点 十六进制互转十进制

摘要: ```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 阅读(280) 评论(0) 推荐(0) 编辑

2.12 指定缩进

摘要: ```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 阅读(103) 评论(0) 推荐(0) 编辑

2.11 whitespace 去掉空格

摘要: ```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 阅读(133) 评论(0) 推荐(0) 编辑

2.10 csv

摘要: data.csv un_comment.csv 阅读全文

posted @ 2018-03-21 23:50 cucy_to 阅读(99) 评论(0) 推荐(0) 编辑

2.9 字母大小写

摘要: ```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 阅读(130) 评论(0) 推荐(0) 编辑

2.8 decode encode

摘要: cat /Users/zrd/Downloads/gostandardlib/Chapter02/Strings\ and\ Things/recipe08/win1250.txt Gda�sk% decode 阅读全文

posted @ 2018-03-21 23:43 cucy_to 阅读(78) 评论(0) 推荐(0) 编辑

2.7 正则匹配字符串

摘要: ```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 阅读(100) 评论(0) 推荐(0) 编辑

2.6 字符串替换

摘要: 正则替换 阅读全文

posted @ 2018-03-21 23:21 cucy_to 阅读(99) 评论(0) 推荐(0) 编辑

2.5 tabwriter 格式化输出

摘要: ```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 阅读(170) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 下一页

导航