2025-09-11 10:58:19 +10:00
# Strings library
This library adds extra string manipulation functions to ground. It is entirely coded in ground.
2025-09-11 14:45:16 +10:00
Please note that you cannot copy a single function from the package, as some functions rely on other functions in the library (reliance on other functions is detailed below).
2025-09-11 10:58:19 +10:00
## Functions
### fun -char !findChar -string &str -char &char
2025-09-11 14:45:16 +10:00
Finds the index of $char in $string (no prerequisites).
2025-09-11 10:58:19 +10:00
### fun -char !findCharInstance -string &str -char &char -int &instance
2025-09-11 14:45:16 +10:00
Finds the index of the `$instance` th instance of $char in $str (no prerequisites).
2025-09-11 10:58:19 +10:00
### fun -string !mid -string &str -int &idx -int &len
2025-09-11 14:45:16 +10:00
Finds $len characters of $str, starting at $idx (no prerequisites).
2025-09-11 10:58:19 +10:00
### fun -string !inBrackets -string &str -char &left -char &right -int &instance
2025-09-11 14:45:16 +10:00
Finds the content of the `$instance` th instance of brackets, with the left bracket being the $left char and the right bracket of $right char (requires !findCharInstance).
2025-09-11 10:58:19 +10:00
2025-09-11 16:32:50 +10:00
### fun -bool !matchStart -string &str -string &instr
2025-09-11 10:58:19 +10:00
2025-09-11 14:45:16 +10:00
Checks if the start of $str matches $instr (requires !mid).
### fun -int !findStringInstance -string &str -string &instr -int &instance
2025-09-11 16:32:50 +10:00
The same as !findCharInstance, but allows a string to be parsed to be searched for (no prerequisites).
### fun -string !removeLeft -string &string -int &num
Removes the first $num characters from a string (no prerequisites).
### fun -string !removeRight -string &string -int &num
You'll never guess what this does (it removes the last $num characters from a string) (no prerequisites).
### fun -bool !contains -string &str -string &instr
Checks if $str contains $instr (requires !mid).