forceWholeQuantityRange(argNum, argMin [, argMax])
Last updated September 27, 2004
Version: 1 | Requires: ColdFusion 5 | Library: UtilityLib
Description:
Force a value to whole quantity and restrict to a given min/max range.
Return Values:
Returns a number.
Example:
#forceWholeQuantityRange(1.5, 2, 20)#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| argNum | The number to check. | Yes |
| argMin | The minimum value of the range. | Yes |
| argMax | The maximum value of the range. | No |
Full UDF Source:
<cfscript>
/**
* Force a value to whole quantity and restrict to a given min/max range.
*
* @param argNum The number to check. (Required)
* @param argMin The minimum value of the range. (Required)
* @param argMax The maximum value of the range. (Optional)
* @return Returns a number.
* @author Shawn Fairweather (psalm_119_@hotmail.com)
* @version 1, September 27, 2004
*/
function forceWholeQuantityRange(argNum, argMin){
var qnty = argNum;
if(IsNumeric(argNum)){
qnty = int(argNum);
} else {
qnty = argMin;
}
if(argNum LT argMin){
qnty = argMin;
} else if((arrayLen(arguments) gt 2) and (argNum GT arguments[3])){
qnty = arguments[3];
}
return qnty;
}
</cfscript>
Search CFLib.org
Latest Additions
John Bartlett added
browserDetect
4 day(s) ago
Rob Brooks-Bilson added
listCompare
7 day(s) ago
Stephen Withington added
formToNameValueP...
15 day(s) ago
anthony petruzzi added
parseExcel
20 day(s) ago
Pablo Varando added
returnRandomHEXC...
21 day(s) ago
Top Rated
QueryStringChang...
Rated 5.0, 10 time(s)
formToNameValueP...
Rated 5.0, 5 time(s)
HTMLSafe
Rated 5.0, 4 time(s)
viewCSS
Rated 5.0, 4 time(s)
generateRandomKe...
Rated 5.0, 3 time(s)