# LEFT

Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

Tags: string handling

# Description

The LEFT() function extracts a sub-string of a specified length from the beginning of a string.

LEFT(expression, length)
1

Where:

  • expression evaluates to the string from which the sub string is extracted.
  • length is the number of extracted characters if length is less than 1, LEFT() returns null.

# Note

The LEFT function is equivalent to sub-string extraction starting from the first character position, i.e. expression[1,length]

An example of use is as:

str_Val = " Today's Brush is Tomorrows Forest.- Bemba Proverb"
CRT LEFT(str_Val, 14)
CRT DQUOTE(LEFT(str_Val, 999))
CRT DQUOTE(LEFT(str_Val, 0))
1
2
3
4

to display:

Today's Brush
" Today's Brush is Tomorrows Forest.- Bemba Proverb"
""
1
2
3

to the screen.

See also: RIGHT

Go back to jBASE BASIC

Go back to Programmers' Reference Guide