RAT( ) Function

Example   See Also

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

Syntax

RAT(cSearchExpression, cExpressionSearched [, nOccurrence])

Returns

Numeric

Arguments

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.

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.