<div class="meta" robots="noindex">

</div>

Method

# RightB

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `String.RightBytes<string.rightbytes>` as a replacement.

</div>

## Description

Returns the last *n* bytes from the `string</api/data_types/string>` specified.

## Usage

*result*=**RightB**(*source*, *count*)

**OR**

*result*=*stringVariable*.**RightB**(*count*)

| Part           | Type                               | Description                                                                                  |
|----------------|------------------------------------|----------------------------------------------------------------------------------------------|
| result         | `String</api/data_types/string>`   | The rightmost *count* bytes of *source*. The encoding of *result* is the same as the source. |
| source         | `String</api/data_types/string>`   | The *source* string from which to get the bytes.                                             |
| count          | `Integer</api/data_types/integer>` | The number of bytes you wish to get from the *source*.                                       |
| stringVariable | `String</api/data_types/string>`   | Any variable of type `String</api/data_types/string>`.                                       |

## Notes

The <span class="title-ref">RightB</span> 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.

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

## Sample code

This example uses the <span class="title-ref">RightB</span> function to return the last 5 bytes from a `string</api/data_types/string>`.

``` xojo
Dim s As String
s = RightB("Hello World", 5) ' returns "World"
s = "Hello World"
s = s.RightB(5) ' returns "World"
```

## Compatibility

All project types on all supported operating systems.

## See also

`String.AscByte<string.ascbyte>`, `String.ChrByte<string.chrbyte>`, `String.IndexOfBytes<string.indexofbytes>`, `String.LeftBytes<string.leftbytes>`, `String.Bytes<string.bytes>`, `String.MiddleBytes<string.middlebytes>`, `String.Right<string.right>` functions; `String</api/data_types/string>` data type.
