CFLib.org – Common Function Library Project

CounterMinusMinus([intCounter])

Last updated April 19, 2002
Download UDF

author

Stephan Scheele                                   Stephan Scheele

Version: 1 | Requires: ColdFusion 5 | Library: DataManipulationLib

 
Rated 1 time(s). Average Rating: 1.0

Description:
Simulate the c functionality of i--. Decrements a counter and returns the value of the counter before it was decremeted.

Return Values:
Returns the value of the variable BEFORE it has been decremented.

Example:

<cfset i=2>
<cfset aArray = arrayNew(1)>
<cfset aArray[counterMinusMinus("i")]="Hans">
<cfset aArray[counterMinusMinus("i")]="Otto">

<cfoutput>
#i#
</cfoutput>

Parameters:

Name Description Required
intCounter The name, not the value, of the variable to be decremented. No

Full UDF Source:

<cfscript>
/**
* Simulate the c functionality of i--.
*
* @param intCounter      The name, not the value, of the variable to be decremented.
* @return Returns the value of the variable BEFORE it has been decremented.
* @author Stephan Scheele (stephan@stephan-t-scheele.de)
* @version 1, April 19, 2002
*/

function counterMinusMinus(intCounter) {    
    var temp = evaluate(intCounter);
    "#intCounter#" = temp - 1;
    return temp;
}
</cfscript>

Search CFLib.org


Latest Additions

Tony Felice Tony Felice added
writeStateSelect
15 hour(s) ago

Tony Felice Tony Felice added
varNameToText
15 hour(s) ago

Larry C. Lyons Larry C. Lyons added
splitMX
15 hour(s) ago

Tony Felice Tony Felice added
listIsItemSimila...
15 hour(s) ago

Tony Felice Tony Felice added
listCountItemSim...
15 hour(s) ago

Top Rated

Rob Brooks-Bilson                                 ListCompare
Rated 5.0, 6 time(s)

Nathan Dintenfass                                 QueryStringChang...
Rated 5.0, 4 time(s)

Rob Brooks-Bilson                                 FormatSSN
Rated 5.0, 2 time(s)

Ben Forta                                         DollarAsString
Rated 5.0, 2 time(s)

Ed Hodder                                         CapFirstTitle
Rated 5.0, 2 time(s)

Created by Raymond Camden / Design by Justin Johnson