Documentation ¶
Index ¶
Constants ¶
const RuneError = utf8.RuneError
const (
UTFMax = 6 // Originally 4 in unicode/utf8
)
Variables ¶
This section is empty.
Functions ¶
func DecodeRuneInString ¶
DecodeRuneInString is like DecodeRune but its input is a string. If s is empty it returns (RuneError, 0). Otherwise, if the encoding is invalid, it returns (RuneError, 1). Both are impossible results for correct, non-empty UTF-8.
An encoding is invalid if it is incorrect UTF-8, encodes a rune that is out of range, or is not the shortest possible UTF-8 encoding for the value. No other validation is performed.
func GetDecodeRuneInString ¶
GetDecodeRuneInString return a decode function that is strict or lax about the utf8 encoding depending on the value of lax. For details see the UTF-8 support section in the Lua 5.4 manual.
func NormalizeNewLines ¶
func StringNormPos ¶
StringNormPos returns a normalised position in the string i.e. -1 -> len(s)
-2 -> len(s) - 1
etc
func UTF8EncodeInt32 ¶
Encode a unicode point with value i into a sequence of bytes, writing into p. p must be big enough (length 6 accomodates all values). Returns the number of bytes written. A non-positive value means an error.
Any non-negative int32 can be encoded, that is why the golang utf8 package cannot be used.
Types ¶
This section is empty.