Aracılığıyla paylaş


ATC( ) Function

Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, without regard for the case of these two expressions.

ATC(cSearchExpression, cExpressionSearched [, nOccurrence])

Return Value

Numeric

Parameters

  • cSearchExpression
    Specifies the character expression that ATC( ) searches for in cExpressionSearched.

  • cExpressionSearched
    Specifies the character expression cSearchExpression searches for.

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

  • nOccurrence
    Specifies which occurrence (first, second, third, and so on) of cSearchExpression is searched for in cExpressionSearched. By default, ATC( ) searches for the first occurrence of cSearchExpression (nOccurrence = 1). Including nOccurrence lets you search for additional occurrences of cSearchExpression in cExpressionSearched.

Remarks

ATC( ) searches the second character expression for the occurrence of the first character expression, without concern for the case (upper or lower) of the characters in either expression. Use AT( ) to perform a case-sensitive search.

ATC( ) returns an integer corresponding to the position where the first character of the character expression is found. If the character expression isn't found, ATC( ) returns 0.

Example

STORE 'Now is the time for all good men ... ' TO gcString
STORE 'IS THE' TO gcFindString
CLEAR
? ATC(gcFindString, gcString)  && Displays 5
STORE 'is' TO gcFindString
? ATC(gcFindString, gcString)  && Displays 5
? ATC('now',gcString)  && Displays 1

See Also

Reference

AT( ) Function

AT_C( ) Function

ATCC( ) Function

ATCLINE( ) Function

ATLINE( ) Function

LEFT( ) Function

RAT( ) Function

RATLINE( ) Function

RIGHT( ) Function

SUBSTR( ) Function

LEFTC( ) Function

RIGHTC( ) Function

SUBSTRC( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)