LEFT$ function

Purpose | Return the left-most n characters of a string.
Syntax | s$ = LEFT$(string_expression, n&)
Remarks | n& is a Long-integer expression and specifies the number of characters in string_expression to be returned. LEFT$ returns a string consisting of the left most n& characters of its string argument. If n& is greater than or equal to the length of string_expression, all of string_expression is returned. If n& is zero, LEFT$ returns an empty string. If the length value parameter is negative, it is interpreted as LEN(string_expression)- ABS(n&). For example, LEFT$("1234567890",-2) returns "12345678".
See also | EXTRACT$, INSTR, LTRIM$, MID$, RIGHT$, RTRIM$, SPLIT, TALLY, TRIM$, VERIFY

Example

' Demonstrate LEFT$ and RIGHT$ functions

DIM TestString$, x$, y$, n AS LONG

TestString$ = "ABCDEFGHIJKLMNOP"

FOR n = 1 TO 14 STEP 2

x$ = LEFT$(TestString$,n)

y$ = RIGHT$(TestString$,n)

NEXT n