Cut areas
Syntax
$string.subString($from)
$string.subString($from, $to)
Description
Cuts a range from the string string
.
Parameters
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
string | String | The string from which a range is to be cut. | yes | |
from | Number | The index of the first letter to be cut (inclusive). The first letter has the index 0 . A negative number is calculated from the end of the string. |
yes | |
to | Number | The index of the letter that directly follows the last letter to be cut (exclusive). A negative number is calculated from the end of the string. | no | It will be cut from the index from to the end of the string. |
Return value
Type: String
The range of the string string
, bounded by from
and to
.
Examples
Cut without to
subString("Hello world!", 6)
Output: world!
The index of the letter "w" is 6. It is cut from there to the end.
Cut with to
subString("Hello world!", 6, 11)
Output: world
The index of the letter "w" is 6, that of the exclamation mark is 11.
Cut from the back without to
subString("123456789", -3)
Output: 789
The third index is selected from behind, i.e. 7.
Cut from behind with to
subString("123456789", -4, -1)
Output: 678
The fourth index 6 is selected from behind and cut to the last index 8.