You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
655 B
Markdown

2 years ago
# go-utf8-codepoint-converter
Converts strings of UTF-8 codepoint representation to the UTF-8 encoding
## Usage
This library takes a literal codepoint string and calculates the UTF-8 encoding of it. Example:
```go
package main
import (
"fmt"
"github.com/RageCage64/go-utf8-codepoint-converter/codepoint"
)
2 years ago
func main() {
codepointStr := "U+1F60A"
utf8bytes, _ := codepoint.Convert(codepointStr)
fmt.Println(string(utf8bytes))
codepointStr = "\\U0001F603"
utf8bytes, _ = codepoint.Convert(codepointStr)
fmt.Println(string(utf8bytes))
2 years ago
}
```
Result:
```
😊
😃
```
Playground: https://go.dev/play/p/Nd6xxU3k7QI