Documentation/Calc Functions/RIGHTB/en

Function name:
RIGHTB

Category:
Text

Summary:
Extracts a sub-string from the right of the supplied text string, with the length of the sub-string specified in bytes.

Syntax:
RIGHTB(Text[; Number of Bytes])

Returns:
Returns a text string comprising the specified number of bytes from the right side of the supplied text string.

Arguments:
Text is a text string (in quotation marks), a number, or a reference to a cell containing one of those types, that is the string from which characters are to be extracted.

Number of Bytes is a non-negative integer, or a reference to a cell containing a non-negative integer, that is the number of bytes to be extracted. If Number of Bytes is omitted, RIGHTB uses the value 1.


 * If Number of Bytes is non-numeric, then RIGHTB reports a #VALUE! error.
 * If Number of Bytes is a non-integer value, RIGHTB truncates it to an integer value.
 * If Number of Bytes is less than 0, then RIGHTB reports an invalid argument error (Err:502).
 * If Text comprises fewer bytes than the value of Number of Bytes, RIGHTB returns a copy of Text.

Details specific to RIGHTB function
If the specified number of bytes would otherwise lead to extracting only one byte of a two-byte character, RIGHTB instead inserts a space character (Unicode U+0020) at the beginning of the returned string.

Examples:
The following examples are similar to those used for the RIGHT function and demonstrate the consistent behavior of the two functions for single-byte character strings.

The remaining examples demonstrate the behavior of RIGHTB for strings that include double-byte characters. These examples utilize the double-byte characters "中" (Unicode CJK Unified Ideograph-4E2D) and "国" (CJK Unified Ideograph-56FD).

Related LibreOffice functions:
FINDB

LEFTB

LENB

MIDB

REPLACEB

RIGHT

SEARCHB

ODF standard:
Section 6.7.7, part 2

Equivalent Excel functions:
RIGHTB