update readme with playground

main
RageCage64 2 years ago
parent 51492ccb99
commit d1ae729e5c

@ -9,13 +9,17 @@ This library takes a literal codepoint string and calculates the UTF-8 encoding
```go ```go
package main package main
import "github.com/RageCage64/go-utf8-codepoint-converter/codepoint" import (
"fmt"
"github.com/RageCage64/go-utf8-codepoint-converter/codepoint"
)
func main() { func main() {
codepointStr := "U+1F60A" codepointStr := "U+1F60A"
utf8bytes, _ := codepoint.Convert(codepointStr) utf8bytes, _ := codepoint.Convert(codepointStr)
fmt.Println(string(utf8bytes)) fmt.Println(string(utf8bytes))
codepointStr := "\\U0001F603" codepointStr = "\\U0001F603"
utf8bytes, _ = codepoint.Convert(codepointStr) utf8bytes, _ = codepoint.Convert(codepointStr)
fmt.Println(string(utf8bytes)) fmt.Println(string(utf8bytes))
} }
@ -25,3 +29,4 @@ Result:
😊 😊
😃 😃
``` ```
Playground: https://go.dev/play/p/Nd6xxU3k7QI
Loading…
Cancel
Save