Module: nupp.data.utf8

UTF-8 codepoint operations over strings and byte views.

Module contents

Functions

FunctionKindDescription
decodeAtfunction
decodeBeforefunction
encodefunction
isValidfunction
lengthfunction
truncatefunction
validPrefixLengthfunction

Functions#

decodeAtfunction#

local decodeAt: function(value: string | nupp.ByteView, byteOffset: integer): (integer?, integer)

Arguments

NameTypeDescription
valuestring | nupp.ByteView
byteOffsetinteger

Returns

TypeDescription
integer?
integer

decodeBeforefunction#

local decodeBefore: function(value: string | nupp.ByteView, byteOffset: integer): (integer?, integer)

Arguments

NameTypeDescription
valuestring | nupp.ByteView
byteOffsetinteger

Returns

TypeDescription
integer?
integer

encodefunction#

local encode: function(codepoint: integer): string

Arguments

NameTypeDescription
codepointinteger

Returns

TypeDescription
string

isValidfunction#

local isValid: function(value: string | nupp.ByteView): boolean

Arguments

NameTypeDescription
valuestring | nupp.ByteView

Returns

TypeDescription
boolean

lengthfunction#

local length: function(value: string | nupp.ByteView): integer

Arguments

NameTypeDescription
valuestring | nupp.ByteView

Returns

TypeDescription
integer

truncatefunction#

local truncate: function(text: string, maxBytes: integer): string

Arguments

NameTypeDescription
textstring
maxBytesinteger

Returns

TypeDescription
string

validPrefixLengthfunction#

local validPrefixLength: function(value: string | nupp.ByteView, maxBytes: integer): integer

Arguments

NameTypeDescription
valuestring | nupp.ByteView
maxBytesinteger

Returns

TypeDescription
integer