$left

Extracts a segment from the front of a character string.

Syntax

$left(source,length)

Parameters

source

a character string or an expression that evaluates to a character string

length

a number or an expression that evaluates to a number

Return Value

Character string, consisting of a string containing length characters from source, starting in the first position.

Comments

Use $left to produce a string consisting of length characters from source, starting in the first position.

If source is not of a character data type, it is converted to a character data type before processing.

If length is zero or negative, the result is the null string. If length is longer than source, the result is source.

Example

$left("abcdefgh",5)

Evaluates to "abcde".

$left(9999,1)

Evaluates to " ", because numbers are converted to character strings containing seventeen characters before being processed by $left.

$left(1234567890,10)

Evaluates to " 123". Number literals convert to character strings containing seventeen characters before being processed by $left.

 

Related Topics