<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>RIGHT</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">RIGHT</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Gets a specified number of characters from a string, beginning at the right.
</p>

<p>
Returns the specified number of characters from the end (or right side) of the specified string.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span><ul>

<li>If the length of the string is greater than or equal to count, the rightmost count characters of the string</li>

<li>If count is greater than the length of the string, the whole string</li>

<li>If count is greater than 1, and the string is empty, an empty string</li>
</ul>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
String functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>Right(string, count)
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
Left, Mid, Reverse
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;!--- Simple Right Example---&gt;
&lt;cfoutput&gt;
#Right(&quot;See the quick red fox jump over the fence&quot;, 9)#
&lt;br&gt;
#Right(&quot;ColdFusion&quot;, 6)#
&lt;/cfoutput&gt;

&lt;!--- Right Example using form input ---&gt;
&lt;h3&gt;Right Example&lt;/h3&gt;
&lt;cfif IsDefined(&quot;Form.MyText&quot;)&gt;
&lt;!--- If len returns 0 (zero), then show error message. ---&gt;
   &lt;cfif Len(FORM.myText)&gt;
      &lt;cfif Len(FORM.myText) LTE FORM.RemoveChars&gt;
         &lt;cfoutput&gt;&lt;p style=&quot;color: red; font-weight: bold&quot;&gt;Your string
         #FORM.myText# only has #Len(FORM.myText)# characters. You cannot output
         the #FORM.removeChars# rightmost characters of this string because it 
         is not long enough.&lt;/p&gt;&lt;/cfoutput&gt;
      &lt;cfelse&gt;
         &lt;cfoutput&gt;&lt;p&gt;Your original string: &lt;strong&gt;#FORM.myText#&lt;/strong&gt;
         &lt;p&gt;Your changed string, showing only the &lt;strong&gt;#FORM.removeChars#
         &lt;/strong&gt; rightmost characters:
         &lt;strong&gt;#right(Form.myText, FORM.removeChars)#&lt;/strong&gt;&lt;/p&gt;
         &lt;/cfoutput&gt;
      &lt;/cfif&gt; 
   &lt;cfelse&gt;
      &lt;p style=&quot;color: red; font-weight: bold&quot;&gt;Please enter a string of more
      than 0 (zero) characters.&lt;/p&gt;
   &lt;/cfif&gt;
&lt;/cfif&gt;

&lt;form action=&quot;&lt;cfoutput&gt;#CGI.ScriptName#&lt;/cfoutput&gt;&quot; method=&quot;POST&quot;&gt;
&lt;p&gt;Type in some text&lt;br /&gt;
&lt;input type=&quot;Text&quot; name=&quot;myText&quot;&gt;&lt;/p&gt;
&lt;p&gt;How many characters from the right do you want to show?
&lt;select name=&quot;RemoveChars&quot;&gt;
&lt;option value=&quot;1&quot;&gt;1
&lt;option value=&quot;3&quot; selected&gt;3
&lt;option value=&quot;5&quot;&gt;5
&lt;option value=&quot;7&quot;&gt;7
&lt;option value=&quot;9&quot;&gt;9&lt;/select&gt;
&lt;input type=&quot;Submit&quot; name=&quot;Submit&quot; value=&quot;Remove characters&quot;&gt;&lt;/p&gt;
&lt;/form&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="STRING">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">STRING</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A string or a variable that contains one. </p>

  </td>
  </tr>
  </table>
</div>
<div id="COUNT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">COUNT</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>A positive integer that specifies the number of characters to return.</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
