Returns a specified number of characters from the beginning of a string.

Syntax

LEFT(<expC>, <expN>)

<expC>

The string from which you want to extract characters.

<expN>

The number of characters to extract from the beginning of the string.

Description

Starting with the first character of a character expression, LEFT( ) returns <expN> characters. If <expN> is greater than the number of characters in the specified string, LEFT( ) returns the string as it is, without adding spaces to achieve the specified length. You can use LEN( ) to determine the actual length of the returned string.

If <expN> is less than or equal to zero, LEFT( ) returns an empty string. If <expN> is greater than or equal to zero, LEFT(<expC>, <expN>) achieves the same results as SUBSTR(<expC>, 1, <expN>).

When LEFT( ) returns characters from a memo field, it counts two characters for each carriage-return and linefeed combination (CR/LF).

Other than the syntactic difference of being a method instead of a function, the left( ) method behaves identically to the LEFT( ) function.