[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|               LEN               |
+---------------------------------+
LEN(<expC>)

-----------------------------------
Returns length of <expC>.
Return value - Numeric
-----------------------------------

This function returns the length of the character string expression
<expC>.  The character expression may be a character string, a memo or a
character field name.  If <expC> is a memo field name, the length of the
memo field is returned.

If the expression contains the null string, LEN() returns a value of 0.

+---------------------------------+
|         Program Example         |
+---------------------------------+
In the example below, length of database field CUST_ID is used to store
spaces to a memory variable, and the memory variable, along with two
prompts, is displayed for input. When the program asks you for input,
enter a number like 000001.  After the READ, LEN() is used again to see
if the memory variable is empty.  If it is, the program is exited.

SET TALK OFF
CLEAR
USE customer ORDER TAG cust_id
STORE .F. TO mexit
DO WHILE NOT mexit
    STORE SPACE(LEN(cust_id)) TO mcust_id
    @ 10,10 SAY 'Enter customer id to locate: ' GET mcust_id
    @ 12,15 SAY 'Leave entry blank to exit'
    READ
    @ 20,0 CLEAR
    IF LEN(TRIM(mcust_id)) = 0
        STORE .T. TO mexit
    ELSE
        SEEK mcust_id
        IF FOUND()
           @ 20,10 SAY 'Company is '+ company
        ELSE
           @ 20,10 SAY 'No company for customer: ' + mcust_id
        ENDIF
    ENDIF
ENDDO
USE

-----------------------------------

See Also:  EMPTY(), FSIZE()

-----------------------------------

See Also: EMPTY() FSIZE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson