The features described in this topic are obsolete
and should not be used in new IDL code.

RSTRPOS

This routine is obsolete and should not be used in new IDL code.

The RSTRPOS function has been replaced by the STRPOS function's REVERSE_SEARCH keyword. See "STRPOS" (IDL Reference Guide).

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.

Syntax

Result = RSTRPOS( Expression, Search_String [, Pos] )

Arguments

Expression

The expression string in which to search for the substring.

Search_String

The substring to be searched for within Expression.

Pos

The character position before which the search is begun. If Pos is omitted, the search begins at the last character of Expression.

Example

; Define the expression: 
exp = 'Holy smokes, Batman!' 
; Find the position of a substring: 
pos = RSTRPOS(exp, 'smokes') 
; Print the substring's position: 
PRINT, pos 

IDL prints:

5 

Note
Substring begins at position 5 (the sixth character).