Left

From Xojo Documentation
Jump to: navigation, search
Method

Returns the first n characters in a source string.

Syntax

result=Left(source, count)
OR
result=stringVariable.Left(count)

Part Type Description
result String The first count characters of source.
source String The source string from which to get the characters.
stringVariable String The String variable from which to get the characters.
count Integer The number of characters you wish to get from source.

If count is greater than the number of characters in source, all characters are returned.

stringVariable String Any variable of type String.

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 LeftB function.

Examples

This example returns the first five characters in a string.

Dim s As String
s = Left("Hello World", 5) // returns "Hello"
s = "Hello World"
s = s.Left(5) // returns "Hello"

See Also

Asc, Chr, InStr, Len, LeftB, Mid, Right functions.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About