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>substr()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SUBSTR()


Syntax:     SUBSTR(<expC>, <expN1> [,<expN2>])

Purpose:    To return a portion of a character string.

Arguments:  <expC> is the source character string.  The maximum
            character string that you can take a substring of is 65,535
            (64K) bytes, the maximum character string size in Clipper.

            <expN1> is the starting position in the source string to
            begin the substring.  If the starting position is positive,
            it is relative to the leftmost character in the string.  If
            the starting position is negative, the starting position is
            relative to the rightmost character in the string.

            <expN2> is the number of characters to return.  If this
            argument is omitted, the substring begins at the starting
            position and continues to the end of the string.  If it is
            larger than the number of characters from the starting
            position to the end of the string, the extra is ignored.

Returns:    A character string.

Usage:      SUBSTR() is useful when you want to display or print only a
            portion of a character string.

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   char = "this is a string"

   ? SUBSTR(char, 1, 4)             && Result: this
   ? SUBSTR(char, 6)                && Result: is a string
   ? SUBSTR(char, LEN(char) + 2)    && Result: null string
   ? SUBSTR(char, -6)               && Result: string
   ? SUBSTR(char, -6, 3)            && Result: str


See Also: AT() LEFT() RAT() RIGHT()

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