reverse
Description
Reverses the order of items, such as the characters in a string or the digits in a number.
Categories
Related
Syntax
Reverse(string)
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| string | A string or a variable that contains one |
Returns
A copy
of string, with the characters in reverse order.
Usage
You can call this function on a number with code such as the following:
<cfoutput>reverse(6*2) equals #reverse(6*2)#<cfoutput> This code outputs the following:
reverse(6*2) equals 21
<cfoutput>reverse(6*2) equals #reverse(6*2)#<cfoutput> This code outputs the following:
reverse(6*2) equals 21
Example
<h3>Reverse Example</h3>
Reverse returns your string with the positions of the characters reversed.
<cfif IsDefined("FORM.myString")>
<cfif FORM.myString is not "">
Reverse returned:
<cfoutput>#Reverse(FORM.myString)#</cfoutput>
<cfelse>
Please enter a string to be reversed.
</cfif>
</cfif>
<form action = "reverse.cfm">
Enter a string to be reversed:
<input type = "Text" name = "MyString">
<input type = "Submit" name = "">
</form>