String.last_index_of

String.last_index_of

String.last_index_of

Function

Returns the position of the last occurrence of the specified fragment.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
needleAnyNo''The fragment to be found will be converted into a string first when called.

Return value

TypeDescription
IntReturns the starting byte position if found; returns -1 if not found.

Example

Notes

  • The return value is calculated as a UTF-8 byte offset.