reversePosIndex
reversePosIndex(substr: StringUtf8; index: Integer): Integer;
The reversePosIndex method of the StringUtf8 primitive type returns the position of the last occurrence of the substring specified in the substr parameter, in a string formed from the first character of the receiving string up to (and including) the character position specified in the index parameter.
The character search is case-sensitive.
The value of the index parameter cannot exceed the length of the receiving string.
The following example shows the use of the reversePosIndex method.
vars str8 : StringUtf8; count : Integer; begin str8 := "car->taxi->bus->train"; count := str8.length; while count > 0 do count := str8.reversePosIndex('->', count); write count; count := count - 1; endwhile; // Outputs 15 // Outputs 10 // Outputs 4 // Outputs 0 end;
This method returns zero (0) if the specified substring is not found.