Shiny Language Reference

Language Reference > String Functions


strfind

int strfind(string Target, string SubString);

 

Synonyms:

int find(string Target, string SubString);
 

Returns the position of the first occurrence of a substring

STRFIND scans 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.

The dual syntax FIND can be used in place of STRFIND.

 

Parameters

Target

The string to search inside

SubString

The substring to locate in the target string

 

Return Value

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

 

Example Code

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

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