String.lastIndexOf
lastIndexOf — Finds the position of the last occurrence of a string within a string.
Description
String.lastIndexOf(string string, [integer offset])
Parameters
Name | Description | Type | Default | Optional |
---|---|---|---|---|
string | string | No | ||
offset | Counting from beginning of string. | integer | Yes |
Return values
number primitive.
Examples
Example #1 – lastIndexOf example
When passing the secions parameter, it will start searching at the given position (counting from the beginning). This example illustrates this with a string that is cut to the same length.