1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 07:42:27 +08:00

doc: add go playground demo

This commit is contained in:
dudaodong
2023-06-20 14:04:18 +08:00
parent 3050d93703
commit 8f49078eb3
12 changed files with 63 additions and 21 deletions

View File

@@ -380,7 +380,7 @@ func ToInterface(v reflect.Value) (value interface{}, ok bool) {
}
// Utf8ToGbk convert utf8 encoding data to GBK encoding data.
// Play: todo
// Play: https://go.dev/play/p/9FlIaFLArIL
func Utf8ToGbk(bs []byte) ([]byte, error) {
r := transform.NewReader(bytes.NewReader(bs), simplifiedchinese.GBK.NewEncoder())
b, err := io.ReadAll(r)
@@ -388,7 +388,7 @@ func Utf8ToGbk(bs []byte) ([]byte, error) {
}
// GbkToUtf8 convert GBK encoding data to utf8 encoding data.
// Play: todo
// Play: https://go.dev/play/p/OphmHCN_9u8
func GbkToUtf8(bs []byte) ([]byte, error) {
r := transform.NewReader(bytes.NewReader(bs), simplifiedchinese.GBK.NewDecoder())
b, err := io.ReadAll(r)