Documentation
¶
Overview ¶
stringy provides utilities for working with UTF-8, UTF-16, and UTF-32 encoded strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Utf16CodeUnits ¶
Utf16CodeUnits returns the number of code units in the UTF-16 encoding of the string.
Types ¶
type String ¶
type String interface {
// String returns the string representation of the string.
String() string
// CodeUnits returns the number of code units in the string.
CodeUnits() int
// CodePoints returns the number of code points in the string.
// This is the number of runes in the string and what you would use for character-based operations.
CodePoints() int
}
type Utf16 ¶
type Utf16 []uint16
Utf16 is a slice of uint16 values that represents a UTF-16 encoded string.
*Utf16 implements the io.StringWriter and io.Writer interfaces.
func (*Utf16) AppendRunes ¶
AppendRunes appends a rune slice to the Utf16 slice.
func (Utf16) CodePoints ¶
CodePoints returns the number of code points in the Utf16 slice.
type Utf32 ¶
type Utf32 []rune
Utf32 is a slice of runes that represents a UTF-32 encoded string.
*Utf32 implements the io.StringWriter and io.Writer interfaces.
func (*Utf32) AppendRunes ¶
AppendRunes appends a rune slice to the Utf32 slice.
type Utf8 ¶
type Utf8 string
Utf8 is a string type that supports UTF-8 encoding.
It is implemented as a string since Go's built-in string type is already UTF-8 encoded. Because of this, Utf8 does not implement the same interfaces for updating as the other types.
func (Utf8) CodePoints ¶
CodePoints returns the unicode charachter length of this string.