substring: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Added note re: negative indexes) |
||
Line 3: | Line 3: | ||
|version=1.3b48 | |version=1.3b48 | ||
|description= | |description= | ||
Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. If the end parameter is not specified then the substring extends to the end of the string. | Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. Negative indexes count from the end of the string; the index {{code|-1}} is equivalent to the last character. If the end parameter is not specified, then the substring extends to the end of the string. | ||
|usage= | |usage= |
Revision as of 07:06, 27 November 2023
substring() Function
• Introduced in version 1.3b48
Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. Negative indexes count from the end of the string; the index
-1
is equivalent to the last character. If the end parameter is not specified, then the substring extends to the end of the string.Usage
substring(str, start)
substring(str, start, end)
Examples
[substring("This is a test", 5)]
[substring("This is a test", 5, 7)]
Returns
is a test is