Right  
Description
Gets a specified number of characters from a string, beginning at the right.
 
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)
 
See also
Mid, Left, Reverse
 
Parameters
 
Parameter      Description
string A string or a variable that contains one
count A positive integer or a variable that contains one. Number of characters to return.
 
Example
<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>

string  
A string or a variable that contains one
count  
A positive integer or a variable that contains one. Number of characters to return.