Skip to content

String Module

The string module contains functions for text processing. Strings use double quotes and support up to 10,000 characters.


FunctionReturnsDescription
string.upper(text)stringConverts every character to uppercase.
string.lower(text)stringConverts every character to lowercase.
lau-compiler.exe
varol toUpper = "shouting"
varol toLower = "WHISPERING"
print(string.upper(toUpper))
print(string.lower(toLower))
OUTPUT:
SHOUTING whispering

FunctionReturnsDescription
string.len(text)numberReturns the total number of characters.
string.find(text, target, start?, isPlain?)numberReturns the start index of the target text, or null, start is a number indicating the position to start searching from, isPlain is a boolean indicating whether to perform a plain text search.
lau-compiler.exe
varol input = "Hello Drone"
print("Length: " + string.len(input))
varol position = string.find(input, "Drone")
print("Found 'Drone' at index: " + position)
OUTPUT:
Length: 10 Found 'Drone' at index: 7

FunctionReturnsDescription
string.sub(text, start, end?)stringReturns a slice of the string from start to end.
lau-compiler.exe
varol fullName = "Unit-Drone-V2"
print("Nickname: " + string.sub(fullName, 6, 10))
OUTPUT:
Nickname: Drone

FunctionReturnsDescription
string.split(text, separator)listSplits a string into parts using the separator text.
lau-compiler.exe
varol coord = "X,Z"
varol parts = string.split(coord, ",")
print(parts[1])
print(parts[2])
OUTPUT:
X Z