JavaScript Editor js editor     Web development 



Main Page

Returns the numeric position of the last (rightmost) occurrence of a character string within another character string.

RAT(cSearchExpression, cExpressionSearched [, nOccurrence])

Parameters

cSearchExpression


Specifies the character expression that RAT(В ) looks for in cExpressionSearched. The character expression can refer to a memo field of any size.
cExpressionSearched


Specifies the character expression that RAT(В ) searches. The character expression can refer to a memo field of any size.
nOccurrence


Specifies which occurrence, starting from the right and moving left, of cSearchExpression RAT(В ) searches for in cExpressionSearched. By default, RAT(В ) searches for the last occurrence of cSearchExpression (nOccurrence = 1). If nOccurrence is 2, RAT(В ) searches for the next to last occurrence, and so on.

Return Value

Numeric

Remarks

RAT(В ), the reverse of the AT(В ) function, searches the character expression in cExpressionSearched starting from the right and moving left, looking for the last occurrence of the string specified in cSearchExpression.

RAT(В ) returns an integer indicating the position of the first character in cSearchExpression in cExpressionSearched. RAT(В ) returns 0 if cSearchExpression isn't found in cExpressionSearched, or if nOccurrence is greater than the number of times cSearchExpression occurs in cExpressionSearched.

The search performed by RAT(В ) is case-sensitive.

Example

В Copy Code
STORE 'abracadabra' TO string
STORE 'a' TO find_str
CLEAR
? RAT(find_str,string)  && Displays 11
? RAT(find_str,string,3)  && Displays 6

See Also



JavaScript Editor js editor     Web development