Skip to content

String Module

This module provides functions for manipulating str types. Note that strings in solus can be concatenated using the same + operator as any other value, which is why there is no string.cat(a, b)!

string.len

string.len(string: str) -> i64

Returns the length of a string

Parameters

ParameterTypeDescription
stringstrString to find length of

string.sub

string.sub(string: str, start: i64, end: i64) -> str

Returns a substring using the specified start and end. End must not be before start, and both indices are clamped

Parameters

ParameterTypeDescription
stringstrString to slice
starti64Starting index (zero-based)
endi64Ending index

string.repeat

string.repeat(string: str, count: i64) -> str

Repeats a string count amount of times

Parameters

ParameterTypeDescription
stringstrString to repeat
counti64Amount of times to repeat string

string.join

string.join(strings: obj) -> str

Joins an array of strings into a single str

Parameters

ParameterTypeDescription
stringsobjAn array of strings

string.split

string.split(string: str, delim: str) -> obj

Splits a str into an array of strings separated by a delimiter

Parameters

ParameterTypeDescription
stringstrString to split apart
delimstrSeparator to split at