Left - Built-in String Function¶
Purpose¶
Left returns a string containing a specified number of characters from the left side of the string.
Syntax¶
Left(str, int)
Arguments¶
| Argument | Required | Description |
|---|---|---|
str |
Yes | Any valid string expression from which the specified number of characters are returned. |
int |
Yes | Any valid integer expression. The number of characters returned. |
Returns¶
Variant with a string (VT_BSTR) value
Example¶
Let sTest = "Hello World"
Return Left(sTest, 5) // returns "Hello"
Notes¶
- When
strorintcannot be converted to the specified type, a runtime error is generated. - If
intis 0, an empty string ("") is returned. If greater than or equal to the number of characters instr, the entire string is returned.