CFLib.org – Common Function Library Project

ListValueRange(min, max[, delimiter])

Last updated August 27, 2001

author

Brad Breaux

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Returns a comma delimited list filled with the positive intergers from the specified range.

Return Values:
Returns a string (delimited list).

Example:

<CFOUTPUT>
 #ListValueRange(1,45)#
</CFOUTPUT>

Parameters:

Name Description Required
min Minimum positive integer of range. Yes
max Maximum positive integer of range. Yes
delimiter Delimiter for the list of returned values. Default is the comma. No

Full UDF Source:

/**
 * Returns a comma delimited list filled with the positive intergers from the specified range.
 * Minor modifications by Rob Brooks-Bilson (rbils@amkor.com)
 * 
 * @param min 	 Minimum positive integer of range. 
 * @param max 	 Maximum positive integer  of range. 
 * @param delimiter 	 Delimiter for the list of returned values.  Default is the comma. 
 * @return Returns a string (delimited list). 
 * @author Brad Breaux (bbreaux@blipz.com) 
 * @version 1, August 27, 2001 
 */
function ListValueRange(min,max)
{
  Var cnt=0;
  Var outstring="";
  Var delimiter=",";
  if (ArrayLen(arguments) eq 3){
    Delimiter = arguments[3];
  }
  for(cnt=min;cnt lte max;cnt=cnt+1){
    if (cnt eq 1){
      outstring=""&cnt;
    }
    else{
      outstring=""&outstring&","&cnt;
    }
  }
  return outstring;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson