Left Function

Return the left-most portion of a string. You can use the Len function to determine how many characters are in a string.

Left (string, length)

Parameters

String - (Input, expression, Required)

Specifies the string from which the left-most characters are returned. If a numeric value is passed, it is first converted into a string. If Null is passed, the result is Null. If a non-string is passed, the result is Error.

Length  -  (Input, expression, Required)

Specifies the number of the left-most characters to return. If the length is zero, then a zero length string is returned. If the length is greater than the length of the string, then the entire string is returned. If the length is negative, the result is Error.

Return Value

A string value containing the left-most portion of the passed string.

Examples

Left (“abc”, 6)

Returns “abc”

Left (“abc”, “3”)

Returns “abc”

Left (“abc”, 1)

Returns “a”

Left (“abc”, 0)

Returns “”

Left (“abc”, -1)

Returns Error

Left (123, 2)

Returns “12”

Left (Null, 1)

Returns Null

Left (Error, 1)

Returns Error

TIP:

Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.

See Also

Functions | Asc function | Chr function | CSet function | Format function | InStr function | LCase function | Left function | Len function | LSet function | LTrim function | Mid function | Replace function | Right function | RSet function | RTrim function | Space function | String function | TCase function | Trim function | UBound function | UCase function


© 2004-2021 looksoftware. All rights reserved.