Left$

left$ extracts a sub-string of a string starting from the beginning (the left side).

Syntax

 left$(EXPR_STRING,EXPR_LEN)

Examples

 # Extraction of the first 5 letter of the latin alphabetALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"FIRST_FIVE=left$(ALPHABET, 5) : # Returns "ABCDE"# Computes the length of a string# It would be preferable to use len!!!STRING_LEN = 0While left$(MY_STRING,STRING_LEN) <> MY_STRING : STRING_LEN+=1 : Wend# Truncates a string to a maximum length of 32# the string remains unchanged if its length was smaller than 32MY_STRING=left$(MY_STRING,32)# Truncates a clob to a maximum length of 800# the clob remains unchanged if its length was smaller than 800MY_CLOB=left$(MY_CLOB,800)

Description

The function left$ extracts the first EXPR_LEN characters of a string or a CLOB. According to EXPR_LEN, the type of the result is Char or Clbfile.

Comments

Associated errors

Error codeDescription
10The first argument is not a string, or the second argument is not numeric.
50The second argument is negative.

See also

mid$, right$, seg$, len.