LEFT$()

LEFT$(S,N)

RETURNS THE N FIRST CHARACTERS OF THE STRING S

  • Type: Function
  • Parameters: 2
  • Group: Strings

ACTION

The function LEFT$(S,N) returns the N first characters (on the left) of the string S.

If the number N is greater than or equal to the number of characters of S, S is returned.

N must not be negative. If N is 0, LEFT$ returns the empty string ("").

Remark: the keyword LEFT$ ends by '$' : it means that the returned value is a string.

SYNTAX: Result$=LEFT$(S,N)

  • S = string expression.
  • N = number of characters to be extracted from the string S.
  • Result$ is a string.

USE

  • The function LEFT$() is used to extract a string containing the first characters of a string.

ERROR

  • If S is not a correct expression.
  • If number N is not a correct expression.
  • If N is less than or equal to 0 or greater than 200.

EXAMPLE

print left$("abcd",2)

print "ab"

SEE ALSO

INSERT$()

INSTR()

LEN()

LOWER$()

LTRIM$()

MID$()

RIGHT$()

RTRIM$()

STR$()

STRING$()

TRIM$()

UPPER$()