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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson