Name

right — Return the specified number of characters from the end of a string.

Syntax

right(string, width)
              

The RIGHT function has the following arguments:

string

The string to extract the substring from.

width

The width of the substring to extract.

Description

Returns the last characters in a text string, based on the number of characters you specify. If the width is 0 or less then an empty string is returned. If the width is greater than the length of the string then the full string is returned.

Examples

Formula

Description

Result

right('foobar', 3)

Return the last 3 characters of 'foobar'

'bar'

right('foobar', -1)Return an empty string.''
right('foobar', 24)Return the full string.'foobar'