Xbasic

AT2 Function

Syntax

Position as N = at2(C find_string ,C string [,N starting_position ])

Arguments

find_stringCharacter

The search string.

stringCharacter

The character string to search.

starting_positionNumeric

Default = 1. The position in the string from which to start searching. Numeric

Returns

PositionNumeric

The first location in the string after to the starting position (if specified) where the search string was found. If no match is found, returns 0.

Description

Locates the starting position of a sub string within a character string.

Discussion

AT2() returns a position integer indicating where the sub_string begins in the string. Case sensitive. Use this function for incremental searches through a buffer. The sub_string argument is case sensitive.

Example 

In this case the value soft was found and its position returned.

? at2("soft", "alpha software", 3)
= 7

In this case, the value soft was not found, and the starting position for the next search was returned.

? at2("soft", "alpha software", 10)
= 0

See Also