From d1ae729e5cfbbeaf3cda1cf8c91e76b150fbe399 Mon Sep 17 00:00:00 2001 From: RageCage64 Date: Tue, 30 Aug 2022 13:04:49 -0400 Subject: [PATCH] update readme with playground --- README.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fa75c33..d424ba8 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,24 @@ This library takes a literal codepoint string and calculates the UTF-8 encoding ```go package main -import "github.com/RageCage64/go-utf8-codepoint-converter/codepoint" +import ( + "fmt" + + "github.com/RageCage64/go-utf8-codepoint-converter/codepoint" +) func main() { - codepointStr := "U+1F60A" - utf8bytes, _ := codepoint.Convert(codepointStr) - fmt.Println(string(utf8bytes)) - codepointStr := "\\U0001F603" - utf8bytes, _ = codepoint.Convert(codepointStr) - fmt.Println(string(utf8bytes)) + codepointStr := "U+1F60A" + utf8bytes, _ := codepoint.Convert(codepointStr) + fmt.Println(string(utf8bytes)) + codepointStr = "\\U0001F603" + utf8bytes, _ = codepoint.Convert(codepointStr) + fmt.Println(string(utf8bytes)) } ``` Result: ``` 😊 😃 -``` \ No newline at end of file +``` +Playground: https://go.dev/play/p/Nd6xxU3k7QI \ No newline at end of file