From Xojo Documentation

Revision as of 19:14, 21 January 2022 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Left (the global function) is here for compatibility with Visual Basic. You should instead use String.Left.

Returns the first n characters in a source string.



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.

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


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.


This example returns the first five characters in a string.

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

See Also

String for a complete list of functions.