Right

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

String functions

Function syntax

Right(string, count)

History

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

See also

LeftMidReverse

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>

 Adobe

Get help faster and easier

New user?