Partager via


AT( ) Function

Searches a character expression for the occurrence of another character expression.

Note

The search performed by AT( ) is case-sensitive. To perform a search that is not case-sensitive, use ATC( ). For more information, see ATC( ) Function.

AT(cSearchExpression, cExpressionSearched [, nOccurrence])

Parameters

  • cSearchExpression
    Specifies the character expression to search for in cExpressionSearched.

  • cExpressionSearched
    Specifies the character expression to search for cSearchExpression.

    Both cSearchExpression and cExpressionSearched can be memo fields of any size.

  • nOccurrence
    Specifies which occurrence, first, second, third, and so on, of cSearchExpression to search for in cExpressionSearched. By default, AT( ) searches for the first occurrence of cSearchExpression (nOccurrence = 1).

Return Value

Numeric. AT( ) returns an integer indicating the position of the first character for a character expression or memo field within another character expression or memo field, beginning from the leftmost character. If the expression or field is not found, or if nOccurrence is greater than the number of times cSearchExpression occurs in cExpressionSearched, AT( ) returns 0.

Example

STORE 'Now is the time for all good men' TO gcString
STORE 'is the' TO gcFindString
CLEAR
? AT(gcFindString,gcString)  && Displays 5
STORE 'IS' TO gcFindString
? AT(gcFindString,gcString)  && Displays 0, case-sensitive

See Also

Reference

AT_C( ) Function

ATCLINE( ) Function

ATLINE( ) Function

LEFT( ) Function

RAT( ) Function

RATLINE( ) Function

RIGHT( ) Function

SUBSTR( ) Function

ATCC( ) Function

LEFTC( ) Function

RIGHTC( ) Function

SUBSTRC( ) Function

STREXTRACT( ) Function

$ Operator

OCCURS( ) Function

INLIST( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)