Strings

Provides utility functions for common string operations including casing, trimming, splitting, and generating random strings.


Accessing the Module

local STRINGS <const> = exports.boii_utils:get("modules.strings")

Shared

capitalize(str)

Capitalizes the first letter of each word in the string.

Parameters

Name
Type
Description

str

string

The string to capitalize

Example

local result = STRINGS.capitalize("hello world") -- "Hello World"

random_string(length)

Generates a random alphanumeric string of a given length.

Parameters

Name
Type
Description

length

number

The desired length of the string

Example


split(str, delimiter)

Splits a string into parts using a given delimiter.

Parameters

Name
Type
Description

str

string

The string to split

delimiter

string

The delimiter to split on

Example


trim(str)

Trims whitespace from both ends of the string.

Parameters

Name
Type
Description

str

string

The string to trim

Example

Last updated