Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>ascan()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ASCAN()


Syntax:     ASCAN(<array>, <exp> [,<expN1> [,<expN2>]])

Purpose:    To scan an array for a specific value.

Arguments:  <array> is the array to scan.

            <exp> is the value to scan for.  This can be a valid
            expression of any data type.

            <expN1> is the starting element of the scan.  This
            argument is optional and defaults to one if not specified.

            <expN2> is the number of elements to scan from the
            starting position.  This argument is optional and defaults
            to all elements from the starting element to the end of the
            array.

Returns:    An integer numeric value.

            ASCAN() returns the element position containing the matching
            value.  If no value is found, ASCAN() returns zero.

Usage:      ASCAN() works like SEEK and FIND in the way it performs a
            search.  The <exp> is tested against the target array
            element beginning with the leftmost character in the target
            element and proceeds until there are no more characters left
            in the <exp>.  If there is no match, ASCAN() proceeds to the
            next element in the array.  Note that ASCAN() is also
            sensitive to the status of EXACT.  If EXACT is ON, the
            target array element must match the result of <exp>
            character for character.

Library:    EXTEND.LIB


----------------------------------- Example --------------------------------

   DECLARE dir_list[ADIR("*.txt")]
   ADIR("*.txt", dir_list)

   ptr = ASCAN(dir_list, "TEMP.TXT")

   IF ptr > 0
      dir_list[ptr] = "NEWTEMP.TXT"
   ELSE
      ? "No match was found"
   ENDIF


See Also: SET EXACT LEN()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson