String Module
The string module contains functions for text processing. Strings use double quotes and support up to 10,000 characters.
Case Conversion
Section titled “Case Conversion”| Function | Returns | Description |
|---|---|---|
string.upper(text) | string | Converts every character to uppercase. |
string.lower(text) | string | Converts every character to lowercase. |
lau-compiler.exe
varol toUpper = "shouting"varol toLower = "WHISPERING"
print(string.upper(toUpper))print(string.lower(toLower))OUTPUT:
SHOUTING
whispering
Length And Search
Section titled “Length And Search”| Function | Returns | Description |
|---|---|---|
string.len(text) | number | Returns the total number of characters. |
string.find(text, target, start?, isPlain?) | number | Returns 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
Substrings
Section titled “Substrings”| Function | Returns | Description |
|---|---|---|
string.sub(text, start, end?) | string | Returns 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
Splitting
Section titled “Splitting”| Function | Returns | Description |
|---|---|---|
string.split(text, separator) | list | Splits 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