base64 encoding _ golang

摘要: This syntax imports the encoding/base64 package with the b64 name instead of the default 64. It'll save us some space belowpackage mainimport ( b64... 阅读全文
posted @ 2015-03-30 13:25 xjk112 阅读(279) 评论(0) 推荐(0) 编辑

SHA1 Hashes _ golang

摘要: SHA1 hashes are frequently used to compute short identities for binary or text blobs. For example, the git revision control system uses SHA1 extensive... 阅读全文
posted @ 2015-03-27 13:19 xjk112 阅读(247) 评论(0) 推荐(0) 编辑

URL parsing _ golang

摘要: URLs provide a uniform way to locate resources. Here's how to pare URLs in Gopackage mainimport ( "fmt" "net" "net/url")func main() { s :=... 阅读全文
posted @ 2015-03-27 13:14 xjk112 阅读(322) 评论(0) 推荐(0) 编辑

number parsing _ golang

摘要: Parsing numbers from strings is a basic but common task in many programs; here's how to do it in Gopackage mainimport ( "fmt" "strconv")func mai... 阅读全文
posted @ 2015-03-27 13:06 xjk112 阅读(182) 评论(0) 推荐(0) 编辑

Random numbers _ golang

摘要: Go's math/rand package provides pseudorandom number generationpackage mainimport ( "fmt" "math/rand")func main() { fmt.Print(rand.Intn(100), ... 阅读全文
posted @ 2015-03-26 13:25 xjk112 阅读(257) 评论(0) 推荐(0) 编辑

time formatting _ golang

摘要: Go supports time formatting and parsing via pattern-based layoutspackage mainimport ( "fmt" "time")func main() { p := fmt.Println t := tim... 阅读全文
posted @ 2015-03-26 13:18 xjk112 阅读(289) 评论(0) 推荐(0) 编辑

epoch _ golang

摘要: A common requirement in programs is getting the number of seconds, millisecond, or nanoseconds since Unix epoch. Here's how to do it in Gopackage main... 阅读全文
posted @ 2015-03-26 13:08 xjk112 阅读(192) 评论(0) 推荐(0) 编辑

time _ golang

摘要: Go's offers extensive support for times and durations; here are some examplepackage mainimport ( "fmt" "time")func main() { p := fmt.Println ... 阅读全文
posted @ 2015-03-25 14:13 xjk112 阅读(266) 评论(0) 推荐(0) 编辑

json _ golang

摘要: Go offer built-in support for JSON encoding and decoding, including to and from built-in and custom data typespackage mainimport ( "encoding/json" ... 阅读全文
posted @ 2015-03-25 14:08 xjk112 阅读(233) 评论(0) 推荐(0) 编辑

regular expressions _ golang

摘要: Go ofer built-in support for regular expressions. Here are some examples of common regexp-related tasks in Go.package mainimport ( // "bytes" "f... 阅读全文
posted @ 2015-03-25 13:24 xjk112 阅读(221) 评论(0) 推荐(0) 编辑