JavaScript Editor js editor     Web development 



Main Page

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

ATLINE(cSearchExpression, cExpressionSearched)

Parameters

cSearchExpression


Specifies the character expression that Microsoft Visual FoxPro looks for in cExpressionSearched.
cExpressionSearched


Specifies the character expression that cSearchExpression searches for. Both cSearchExpression and cExpressionSearched can be memo fields of any size. Use MLINE(В ) to return the line containing the matching character expression as a character string.
Tip:
ATLINE() offers a convenient way to search memo fields.

Return Value

Numeric

Remarks

ATLINE(В ) searches the second character expression for the occurrence of the first character expression. ATLINE(В ) performs a case-sensitive search. Use ATCLINE(В ) to perform a search that isn't case-sensitive.

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

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

Example

Example 1 locates the first time a character string occurs in a memo field, displays the first and last names of the employee, and the line of the memo containing the character string.

Example 2 demonstrates how the memo width affects ATLINE(В ).

В Copy Code
* Example 1
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE employee  && Open employee table

CLEAR
STORE 'Japanese' TO gcFindString  && Case sensitive
LOCATE FOR ATLINE(gcFindString, notes) != 0
? First_Name
?? Last_Name
? MLINE(notes, ATLINE(gcFindString, notes))

* Example 2
STORE '1234567890ABCDEFGHIJ' TO gcString
SET MEMOWIDTH TO 20
? ATLINE('AB', gcString)  && Displays 1
SET MEMOWIDTH TO 10
? ATLINE('AB', gcString)  && Displays 2

See Also



JavaScript Editor js editor     Web development