Shiny Language Reference

Language Reference > String Functions


strrfind

int strrfind(string Target, string SubString);

 

Synonyms:

int rfind(string Target, string SubString);
 

Returns the position of the last occurrence of a substring

STRRFIND scans the target string, starting at the end of the target string, for the first occurrence of the substring, then returns the position of the substring or -1 if the substring was not found. This effectively returns the last occurrence of a substring in the target string.

The dual syntax RFIND can be used in place of STRRFIND.

 

Parameters

Target

The string to search inside

SubString

The substring to locate in the target string

 

Return Value

The position of the last occurence of the substring inside the target string.

 

Example Code

// Pos will contain 5
int Pos = strrfind("This is a test", "is");

// Equivalent dual-syntax use
int Pos = rfind("This is a test", "is");