[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
AT()
Return the position of a substring within a character string
------------------------------------------------------------------------------
Syntax
AT(<cSearch>, <cTarget>) --> nPosition
Arguments
<cSearch> is the character substring to be searched for.
<cTarget> is the character string to be searched.
Returns
AT() returns the position of the first instance of <cSearch> within
<cTarget> as an integer numeric value. If <cSearch> is not found, AT()
returns zero.
Description
AT() is a character function used to determine the position of the first
occurrence of a character substring within another string. If you only
need to know whether a substring exists within another string, use the $
operator. To find the last instance of a substring within a string, use
RAT().
Examples
. These examples show typical use of AT():
? AT("a", "abcde") // Result: 1
? AT("bcd", "abcde") // Result: 2
? AT("a", "bcde") // Result: 0
. This example splits a character string based on the position
of a comma within the target string:
cTarget := "Langtree, Lilly"
? SUBSTR(cTarget, 1, AT(",", cTarget) - 1)
// Result: Langtree
? SUBSTR(cTarget, AT(",", cTarget) + 2)
// Result: Lilly
Files Library is CLIPPER.LIB.
See Also:
RAT()
STRTRAN()
SUBSTR()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson