listIsItemSimilar(listIn, strToMatch[, delimeter])
Last updated January 07, 2009
Version: 2 | Requires: CF5 | Library: StrLib
Description:
Determines whether any list items begin with the strToMatch.
Return Values:
Returns a boolean.
Example:
<cfoutput>#listIsItemSimilar("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. | Yes |
delimeter | List delimiter. Defaults to a comma. | No |
Full UDF Source:
/**
* Determines whether any list items begin with the strToMatch.
* v2 by RCamden
*
* @param listIn List of values. (Required)
* @param strToMatch String to search for in the beginning of each list item. (Required)
* @param delimeter List delimiter. Defaults to a comma. (Optional)
* @return Returns a boolean.
* @author Tony Felice (sites@breckcomm.com)
* @version 2, January 6, 2009
*/
function listIsItemSimilar(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){
if(findNoCase(strToMatch,left(listGetAt(listIn,xz,delim),len(strToMatch)))) return true;
}
return false;
}
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