String
Fields
| Name | Type | Description |
|---|---|---|
__type | string | = "string" |
__tonumber | raw.tonumber | |
__len | string.len |
Static functions
#String.__div
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
| Name | Type | Description |
|---|---|---|
str | string | The string to split. |
sizeoptional | integer | The size, in bytes, of each segment. Defaults to 1 (split into individual bytes). Clamped to [1, #str]. |
Returns
| Type | Name | Description |
|---|---|---|
string[] | segments | The array of fixed-size segments. |
integer | segment_count | The number of segments. |