Method

Left

Warning

This item was deprecated in version 2019r2. Please use String.Left as a replacement.


Description

Returns the first n characters in a source string.

Usage

result = sourceVariable.Left(count)

Part

Type

Description

result

String

The first count characters of source.

sourceVariable

String

The source string from which to get the characters.

count

Integer

The number of characters you wish to get from source.

Notes

The Left function returns characters from the source string starting from the Left side (as the name implies).

If you need to read bytes rather than characters, use the MemoryBlock class.

Sample code

This example returns the first five characters in a string.

Var source As String = "Hello World"
source = source.Left(5) ' returns "Hello"

Compatibility

All project types on all supported operating systems.

See also

String for a complete list of functions.