AtLine(), AtCLine(), RAtLine()

These functions are first cousins to AT(), ATC() and RAT(). Like their cousins, they also find occurrences of a specified string in another string, but these check line by line and return the line number where the string can be found. Line numbers are determined by line-break characters and the current value of SET MEMOWIDTH.ATLINE() and company are handy for searching in memo fields, but like many of the memo field-related functions, they work perfectly well on character fields, too.

Usage

nLineFound = ATLINE( cSearchString, cWhereToSearch )
nLineFound = ATCLINE( cSearchString, cWhereToSearch )
nLineFound = RATLINE( cSearchString, cWhereToSearch )

Parameter

Value

Meaning

cSearchString

Character

The string to look for.

cWhereToSearch

Character or Memo

The string in which to look for cSearchString.

nLineFound

0

cSearchString doesn't occur in cWhereToSearch.

Numeric

For ATLINE() and ATCLINE(), the first line of cWhereToSearch containing cSearchString. For RATLINE(), the last line of cWhereToSearch containing cSearchString


As with AT(), RAT() and ATC(), ATLINE() and RATLINE() are case-sensitive while ATCLINE() is not. RATLINE() searches from the last line of cWhereToSearch toward the beginning. Also, like the AT() family, there's no case-insensitive way to search backward.Once you identify the line you want, MLINE() is handy for extracting it.Unlike the AT() family, the ATLINE() functions don't have an optional parameter to specify which occurrence you want, so you have to track this yourself if you need it.

Example

* Find the beginning of notes for 2/1/95
nItemLine = ATLINE("2/1/95", Notes)
 
* Find the first line referencing "freezer", regardless of case
nFreezerLine = ATCLINE("freezer", Description)
 
* Find the last line referencing "degree"
nLastDegree = RATLINE("degree", LOWER(Education))

See Also

ALines(), At(), AtC(), RAt(), MLine(), Set MemoWidth


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .