mirror of
https://github.com/goplus/llgo.git
synced 2025-09-26 19:51:21 +08:00
library: encoding/hex
This commit is contained in:
@@ -292,6 +292,7 @@ Here are the Go packages that can be imported correctly:
|
||||
* [reflect](https://pkg.go.dev/reflect) (partially)
|
||||
* [time](https://pkg.go.dev/time) (partially)
|
||||
* [encoding/binary](https://pkg.go.dev/encoding/binary)
|
||||
* [encoding/hex](https://pkg.go.dev/encoding/hex)
|
||||
* [encoding/base32](https://pkg.go.dev/encoding/base32)
|
||||
* [encoding/base64](https://pkg.go.dev/encoding/base64)
|
||||
* [regexp](https://pkg.go.dev/regexp)
|
||||
|
@@ -3,7 +3,9 @@ package main
|
||||
import (
|
||||
"encoding/base32"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log"
|
||||
)
|
||||
|
||||
func base64Demo() {
|
||||
@@ -30,7 +32,17 @@ func base32Demo() {
|
||||
fmt.Printf("%q\n", dst)
|
||||
}
|
||||
|
||||
func hexDemo() {
|
||||
const s = "48656c6c6f20476f7068657221"
|
||||
decoded, err := hex.DecodeString(s)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("%s\n", decoded)
|
||||
|
||||
}
|
||||
func main() {
|
||||
base64Demo()
|
||||
base32Demo()
|
||||
hexDemo()
|
||||
}
|
||||
|
Reference in New Issue
Block a user