Whatever message this page gives is out now! Go check it out!

Right

Last update:
May 18, 2026

Description

Gets a specified number of characters from a string, beginning at the right.Returns the specified number of characters from the end (or right side) of the specified string.

Returns

  • If the length of the string is greater than or equal to count, the rightmost count characters of the string
  • If count is greater than the length of the string, the whole string
  • If count is greater than 1, and the string is empty, an empty string

Category

Function syntax

Right(string, count)

History

  • ColdFusion (2018 release): Added support for the negative count.

See also

Parameters

Parameter
Description
string
A string or a variable that contains one.
count
A positive integer that specifies the maximum number of characters to return.

Example

<cfscript>
    string="The quick brown fox jumps over the lazy dog"
    count=8
    writeOutput(Right(string,count)) // lazy dog
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page