utf16

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeUTF16LE

func DecodeUTF16LE(b []byte) string

DecodeUTF16LE decodes UTF-16 little endian bytes to a string

This function takes a byte slice and decodes it to a string. It creates a slice of uint16 values with half the length of the byte slice, and fills it with the UTF-16 little endian decoded values. Then, it uses the utf16.Decode function to convert the uint16 slice to a string.

Returns:

  • A string representing the UTF-16 little endian decoded byte slice.

func EncodeUTF16LE

func EncodeUTF16LE(s string) []byte

EncodeUTF16LE encodes a string to UTF-16 little endian bytes

This function takes a string and encodes it to UTF-16 little endian bytes. It uses the utf16.Encode function to convert the string to a slice of uint16 values. Then, it creates a byte slice with twice the length of the utf16le slice, and fills it with the UTF-16 little endian encoded values.

Returns:

  • A byte slice representing the UTF-16 little endian encoded string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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