ATNEXT()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to search a character string for the specified occurrence of a substring

Syntax

ATNEXT(<expC1>, <expC2> [, <expN>])

See Also

AT(), INLIST(), LEFT(), OCCURS(), RAT(), RIGHT(), STR(), STREXTRACT(), STRTRAN(), STUFF(), SUBSTR()

Description

ATNEXT() is a substring search function which returns a number signifying the start position of a specified occurrence of <expC1> in <expC2>. The <expN> specifies the occurrence of <expC1> in <expC2>. The ATNEXT() function returns the value 0 if the specified occurrence does not exist. If <expN> is not specified, ATNEXT() checks for the first occurrence of <expC1>.

The leftmost character of a string is in character position 1. The ATNEXT() function is particularly useful in conjunction with the LEFT() or SUBSTR() functions for locating starting points for extracting text from a string.

Example

? atnext("is", "The fact is that Lianja is good", 2)
        26
cString1 = "is" 
cString2 = "The fact is that Lianja is good"
? atnext(cString1, cString2, 2)
        26

Products

Lianja Server, Lianja