parent
d71ed1e1ff
commit
51492ccb99
@ -1,2 +1,27 @@
|
|||||||
# go-codepoint-converter
|
# go-utf8-codepoint-converter
|
||||||
Converts strings of UTF-8 codepoint representation to the UTF-8 encoding
|
|
||||||
|
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 "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))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Result:
|
||||||
|
```
|
||||||
|
😊
|
||||||
|
😃
|
||||||
|
```
|
Loading…
Reference in New Issue