The RSTRPOS function finds the last occurrence of a substring within an object string (the STRPOS function finds the first occurrence of a substring). If the substring is found in the expression, RSTRPOS returns the character position of the match, otherwise it returns -1.
This routine is written in the IDL language. Its source code can be found in the file
rstrpos.pro
in the
lib
subdirectory of the IDL distribution.
exp = 'Holy smokes, Batman!' ; Define the expression.
pos = RSTRPOS(exp, 'smokes') ; Find the position of a substring.