listCountItemSimilar(listIn[, strToMatch][, delimeter])
Last updated January 07, 2009
Version: 2 | Requires: CF5 | Library: StrLib
Description:
Determines number of list items that begin with the strToMatch.
Return Values:
Returns a number.
Example:
<cfoutput>#listCountItemSimilar("this,that,the other","th")#</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
listIn | List of values. | Yes |
strToMatch | String to search for in the beginning of each list item. | No |
delimeter | List delimiter. Defaults to a comma. | No |
Full UDF Source:
/**
* Determines number of list items that begin with the strToMatch.
* v2 edits by RCamden
*
* @param listIn List of values. (Required)
* @param strToMatch String to search for in the beginning of each list item. (Optional)
* @param delimeter List delimiter. Defaults to a comma. (Optional)
* @return Returns a number.
* @author Tony Felice (sites@breckcomm.com)
* @version 2, January 6, 2009
*/
function listCountItemSimilar(listIn,strToMatch){
var delim = ",";
var count = 0;
var xz = "";
if(arrayLen(arguments) gt 2) delim = arguments[3];
for(xz=1;xz<=listLen(listIn,delim);xz=xz+1) {
count = count + findNoCase(strToMatch,left(listGetAt(listIn,xz,delim),len(strToMatch)));
}
return count;
}
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