dreamworkAPI
Ctrl K
GitHub
typeDocs / String

String

typesource

Fields

NameTypeDescription
__typestring = "string"
__tonumberraw.tonumber
__lenstring.len

Static functions

#String.__div

sharedmenunodiscardsource
function String.__div(str: string, size?: integer): string[], integer

Alias of string.divide.

Splits a string into fixed-size chunks of size bytes each, in order from the start of the string. The final chunk may be shorter than size if the string's length isn't an exact multiple of it.

size is clamped to [1, string length], so it can never be 0 or negative, and a size larger than the string just returns the whole string as a single chunk.

Parameters
NameTypeDescription
strstringThe string to split.
sizeoptionalintegerThe size, in bytes, of each segment. Defaults to 1 (split into individual bytes). Clamped to [1, #str].
Returns
TypeNameDescription
string[]segmentsThe array of fixed-size segments.
integersegment_countThe number of segments.
Generated from the dreamwork meta branch.