[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 LEFT()
 Extract a substring beginning with the first character in a string
------------------------------------------------------------------------------
 Syntax

     LEFT(<cString>, <nCount>) --> cSubString

 Arguments

     <cString> is a character string from which to extract characters.
     The maximum size of <cString> is 65,535 (64K) bytes.

     <nCount> is the number of characters to extract.

 Returns

     LEFT() returns the leftmost <nCount> characters of <cString> as a
     character string.  If <nCount> is negative or zero, LEFT() returns a
     null string ("").  If <nCount> is larger than the length of the
     character string, LEFT() returns the entire string.

 Description

     LEFT() is a character function that returns a substring of a specified
     character string.  It is the same as SUBSTR(<cString>, 1, <nCount>).
     LEFT() is also like RIGHT(), which returns a substring beginning with
     the last character in a string.

     LEFT(), RIGHT(), and SUBSTR() are often used with both the AT() and
     RAT() functions to locate the first and/or the last position of a
     substring before extracting it.

 Examples

     .  This example extracts the first three characters from the left
        of the target string:

        ? LEFT("ABCDEF", 3)                  // Result: ABC

     .  This example extracts a substring from the beginning of a
        string up to the first occurrence of a comma:

        LOCAL cName := "James, William"
        ? LEFT(cName, AT(",", cName) - 1)   // Result: James

 Files   Library is CLIPPER.LIB.


See Also: AT() LTRIM() RAT() RIGHT() RTRIM() STUFF() SUBSTR()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson