Left$ – String Management Function**





Left$ Function


Description

The Left$ function returns the specified number of characters from the specified string starting from the left.

Syntax

var$ = Left$(<string$>, <nbchar>)

Parameters

<string$>: string from which to extract characters.

<nbchar>: numeric, the number of characters to extract.

Return Value

var$: string, return value containing the first <nbchar> characters from <string$>. If <nbchar> is negative or 0, the returned string is empty.

See Also

Right$, Mid$, ExtractBetween$

Examples


a$ = Left$("toto", 2) ' Returns "to" in a$
a$ = Left$("toto", 0) ' Returns "" in a$
b$ = Left$(a$, 2) ' Returns the first 2 characters of a$ and puts them in b$
b$ = Left$(a$, i) ' Returns the first i characters of a$ and puts them in b$