Product SiteDocumentation Site

7.4.37. LEFT


>>-LEFT(string,length--+------+--)-----------------------------><
                       +-,pad-+

Returns a string of length length, containing the leftmost length characters of string. The string returned is padded with pad characters, or truncated, on the right as needed. The default pad character is a blank. length must be a positive whole number or zero. The LEFT function is exactly equivalent to:

>>-SUBSTR(string,1,length--+------+--)-------------------------><
                           +-,pad-+

Here are some examples:

Example 7.50. Builtin function LEFT

LEFT("abc d",8)        ->    "abc d   "
LEFT("abc d",8,".")    ->    "abc d..."
LEFT("abc  def",7)     ->    "abc  de"