Share via


RATLINE( ) Function

Returns the line number of the last occurrence of a character expression within another character expression or memo field, counting from the last line.

RATLINE(cSearchExpression, cExpressionSearched)

Return Values

Numeric

Parameters

  • cSearchExpression
    Specifies the character expression that RATLINE( ) looks for in cExpressionSearched.

  • cExpressionSearched
    Specifies the character expression that RATLINE( ) searches. The character expressions cSearchExpression and cExpressionSearched can be memo fields of any size.

    Use MLINE( ) to return the line containing cSearchExpression.

    **Tip   **RATLINE( ) offers a convenient way to search memo fields.

Remarks

RATLINE( ), the reverse of the ATLINE( ) function, searches a character expression cExpressionSearched, starting with the last character in cExpressionSearched, for the occurrence of cSearchExpression.

If the search is successful, RATLINE( ) returns the number of the line where the match occurs. If the search is unsuccessful, RATLINE( ) returns 0.

The search performed by RATLINE( ) is case-sensitive.

Caution   The line number that RATLINE( ) returns is determined by the value of SET MEMOWIDTH, even if cExpressionSearched isn't a memo field. For more information, see SET MEMOWIDTH.

Example

In the following example, RATLINE( ) returns the line number for the last line in the notes memo field containing the word "graduated." MLINE( ) uses this value to return the contents of the line.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'data\testdata')
USE employee  && Opens Employee table
STORE 'graduated' TO gcString
STORE MLINE(notes, RATLINE(gcString, notes)) TO gnFileLine
? gnFileLine

See Also

AT( ) | AT_C( ) | ATC( ) | ATCLINE( ) | ATLINE( ) | LEFT( ) | RAT( ) | RIGHT( ) | SUBSTR( ) | ATCC( ) | LEFTC( ) | MLINE( ) | RIGHTC( ) | SUBSTRC( ) | $ Operator | OCCURS( ) | INLIST( )