substring
Modified on Wed, 16 Aug 2023
Description
Extract a substring from the given string by using the index values.
Syntax
substring(text, start, end)
Parameters
Input Parameter | Type | Description |
---|---|---|
text | string | Source string |
start | Number | The index of the first character to include in the returned substring |
end (optional) | Number | The index of the first character to exclude from the returned substring |
Return value
Type |
---|
string |
Sample
Example | Result | Description |
---|---|---|
substring('abcdef', 2, 4) | 'cd' | Extract string from index 2 to 4 |
substring('abcdef', 2) | 'cdef' | Extract string from index 2 |
To view all the String functions, click here.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article