Left$

String management function.

The Left$ function returns the specified number of characters from the 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$