String.RightBytes

From Xojo Documentation

Method

String.RightBytes(count As Integer) As String

New in 2019r3

Supported for all project types and targets.

Returns the last count bytes from the String.

Syntax

result = stringVariable.RightBytes(count)

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

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

stringVariable String Any variable of type String.

Notes

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

RightBytes treats source as a series of bytes rather than a series of characters. It should be used when the string represents binary data. If you need to read characters rather than bytes, use the String.Right function.

Examples

This example uses the RightBytes function to return the last 5 bytes from a String.

Var s As String = "Hello World"
s = s.RightBytes(5) // returns "World"

See Also

AscB, ChrB, InStrB, String.LeftBytes, String.Bytes, String.MiddleBytes, String.Right, MemoryBlock.RightB functions ; String data type