Difference between revisions of "LeftB"

From Xojo Documentation

m (Text replacement - "{{Deprecated|" to "{{DeprecatedItem|")
Line 9: Line 9:
<font color="green"><i>Introduced 5.0</i></font><br/>
''result''='''LeftB'''(''source'', ''count'')<br />
''result''='''LeftB'''(''source'', ''count'')<br />
OR<br />
OR<br />

Latest revision as of 00:13, 23 February 2022


Returns the first n bytes in a source string.


result=LeftB(source, count)

Part Type Description
result String The first count bytes of source. The encoding of result is the same as the source.
source String The source string from which to get the bytes.
count Integer The number of bytes you wish to get from source.

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

stringVariable String Any variable of type String.


The LeftB function returns bytes from the source string starting from the left side (as the name implies). The encoding of the result is the same as the encoding of the source string.

If you need to read characters rather than bytes, use the Left function.


This example uses the LeftB function to return the first 5 bytes from a string.

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

See Also

AscB, ChrB, InStrB, Left, LenB, MidB, RightB functions.