FindLast()
Finds the last occurrence of a substring in a string, from a specified start position. The search is case-sensitive.
Introduced: 5.3.5.22
FindLast( substring=string, string=string, start=number );
Returns: Number
Argument | Description | Default |
---|---|---|
substring
string,
required
|
String for which to search. |
|
string
string,
required
|
String in which to search. |
|
start
number,
optional
|
End position of search from the left. |
1 |
Examples
sentences="Swansea Jack was a black retriever with a longish coat. He lived in the North Dock / River Tawe area of Swansea, what gave him the name of Swansea Jack. Swansea Jack's first rescue, in June 1931, when he saved a 12-year-old boy, went unreported.";
dump( right( sentences, len( sentences )- sentences.findlast( "Swansea Jack" ) + 1 ) );
See also
- Strings
- string.findLast()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)