util.string.remove
Shared
Removes a range of characters from a string
Syntax
local result = util.string.remove(
input,
start_at = -1,
end_at = -1
)Parameters
| Type | Name | Description |
|---|---|---|
string | input | String to remove characters from |
int | start_at | Character position to start removing from - negative counts from end |
int | end_at | Character position to stop removing at (inclusive) - negative counts from end |
Returns
| Type | Name | Description |
|---|---|---|
string | result | String with the given character range removed |
Examples
local result = util.string.remove("hello!")
core.engine.print("info", result) -- 'hello'local result = util.string.remove("hello", 1, 1)
core.engine.print("info", result) -- 'ello'local result = util.string.remove("hello world", 6, 11)
core.engine.print("info", result) -- 'hello'local result = util.string.remove("hello", -3, -1)
core.engine.print("info", result) -- 'he'