Right

Extract the rightmost count characters from a string

Method Signature

Right(string=[string], count=[integer])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The string to extract from

count

integer

true

The number of characters to retrieve.

Examples

Using right() on a string

In this example we'll use right() to return part of a string.

Run Example

writeOutput( right( "The quick brown fox jumped over the lazy dog", 8 ) );

Result: lazy dog

Using right() with a negative count on a string

In this example we'll use a negative count right() to return part of a string. CF2018+

Run Example

Result: the lazy dog

Using right() in a function

In this example we'll use right() in a function to help us to capitalize the last letter in a string.

Run Example

Using right() to test values

In this example we'll use right() to test the last five characters of a request context variable.

Using right() as a member function

In this example we'll use right() as a member function inside a function to help us to capitalize the last letter in a string.

Run Example

Additional Examples

Run Example

Last updated

Was this helpful?