utf16

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode added in v1.8.0

func Decode(p []uint16) string

Decode decodes the UTF16-encoded string to UTF-8 string. This function exhibits much better performance than the standard library counterpart. All credits go to: https://gist.github.com/skeeto/09f1410183d246f9b18cba95c4e602f0

func PtrToString

func PtrToString(p unsafe.Pointer) string

PtrToString is like UTF16ToString, but takes *uint16 as a parameter instead of []uint16.

func StringToUTF16Ptr

func StringToUTF16Ptr(s string) *uint16

StringToUTF16Ptr returns the pointer to UTF-8 encoded string. It will silently return an invalid pointer if `s` argument contains a NUL byte at any location.

Types

type UnicodeString

type UnicodeString struct {
	Length    uint16
	MaxLength uint16
	Buffer    *uint16
}

UnicodeString stores the size and the memory buffer of the unicode string.

func (UnicodeString) String

func (u UnicodeString) String() string

String returns the native string from the Unicode stream.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL