package unistring
Import Path
github.com/dop251/goja/unistring (on go.dev)
Dependency Relation
imports 4 packages, and imported by 3 packages
Involved Source Files
Package unistring contains an implementation of a hybrid ASCII/UTF-16 string.
For ASCII strings the underlying representation is equivalent to a normal Go string.
For unicode strings the underlying representation is UTF-16 as []uint16 with 0th element set to 0xFEFF.
unicode.String allows representing malformed UTF-16 values (e.g. stand-alone parts of surrogate pairs)
which cannot be represented in UTF-8.
At the same time it is possible to use unicode.String as property keys just as efficiently as simple strings,
(the leading 0xFEFF ensures there is no clash with ASCII string), and it is possible to convert it
to valueString without extra allocations.
Package-Level Type Names (only one)
Package-Level Functions (total 4)
func NewFromRunes(s []rune) String func NewFromString(s string) String
Scan checks if the string contains any unicode characters. If it does, converts to an array suitable for creating
a String using FromUtf16, otherwise returns nil.
Package-Level Constants (only one)
const BOM = 65279![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |