string.trimPrefix
This function returns the input string without the provided leading prefix string. If the input string does not start with the prefix, it is returned unchanged.
Syntax
string.trimPrefix(str, prefix)
Arguments
|
Argument |
Type |
Description |
|---|---|---|
|
str |
string |
Source string |
|
prefix |
string |
Leading prefix string |
Returns
|
Type |
Description |
|---|---|
|
string |
|
Examples
- The function
string.trimPrefix("Hello World ", "Hello")returnsWorld. - The function
string.trimPrefix("¡¡¡Hello, Gophers!!!", "¡¡¡Hello,")"returnsGophers!!!.