RATC( ) Function

Returns the numeric position of the last occurrence of a character expression or memo field within another character expression or memo field.

RATC(cSearchExpression, cExpressionSearched [, nOccurrence])

Return Values

Numeric

Parameters

  • cSearchExpression
    Specifies the character expression that RATC( ) looks for in cExpressionSearched.
  • cExpressionSearched
    Specifies the character expression that RATC( ) searches. The character expressions cSearchExpression and cExpressionSearched can be memo fields of any size.
  • nOccurrence
    Specifies which occurrence, starting from the right and moving left, of cSearchExpression RATC( ) searches for in cExpressionSearched. By default, RATC( ) searches for the last occurrence of cSearchExpression (nOccurrence equals 1). If nOccurrence is 2, RATC( ) searches for the next to last occurrence, and so on.

Remarks

RATC( ) is designed for expressions containing double-byte characters. If the expression contains only single-byte characters, RATC( ) is equivalent to RAT( ).

RATC( ) returns the numeric position of the last occurrence of a character expression or memo field within another character expression or memo field. The character expressions or memo fields can contain any combination of single-byte and double-byte characters.

RATC( ) is the reverse of the AT_C( ) function: it searches from right to left.

RATC( ) returns an integer indicating the position of the first character in cSearchExpression in cExpressionSearched. RATC( ) 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 RATC( ) is case-sensitive.

This function is useful for manipulating double-byte character sets for languages such as Hiragana and Katakana.

See Also

AT_C( ) | LEFTC( ) | RAT( ) | RIGHTC( ) | SUBSTRC( )