Right

Description

Returns the rightmost count characters of a string.

Category

String functions

Syntax

Right(string, count) 

See also

Mid, Left, Reverse

Parameters

Parameter
Description
string
String from which the rightmost characters are retrieved
count
Integer; number of characters to return

Example

<!--- This example shows the use of Right --->
<html>
<head>
<title>Right Example</title>
</head>

<body bgcolor = silver>
<H3>Right Example</H3>

<cfif IsDefined("Form.MyText")>
<!--- if len is 0, then err --->
  <cfif Len(FORM.myText) is not 0>
    <cfif Len(FORM.myText) LTE FORM.RemoveChars>
    <P>Your string <cfoutput>#FORM.myText#</cfoutput>
    only has <cfoutput>#Len(FORM.myText)#</cfoutput>
    characters. You cannot output the <cfoutput>#FORM.removeChars#
     </cfoutput>
    rightmost characters of this string because it is not long enough
    <cfelse>
    
    <P>Your original string: <cfoutput>#FORM.myText#</cfoutput>
    <P>Your changed string, showing only the 
<cfoutput>#FORM.removeChars#</cfoutput> rightmost characters:
    <cfoutput>#right(Form.myText, FORM.removeChars)#
     </cfoutput>
    </cfif>
  <cfelse>
  <P>Please enter a string
  </cfif>
</cfif>
...