substring
extracts a portion of a string
(string subject, long start, long end) -> string
Returns a substring of subject beginning at index start (inclusive) up to index end (exclusive). If end is nil, the substring extends to the end of subject.
Returns nil if subject is nil.
Returns an empty string if end <= start.
Throws an error if start is nil or start < 0.
Parameters
| Name | Type | Description |
|---|---|---|
subject |
string | The string to split |
start |
long |
The index of the first character that should be in the result. Indexes are zero-based, i.e. the first character is at index 0. |
end |
long |
The index of the first character to not include in the result. Indexes are zero-based, i.e. the first character is at index 0. If |