ColdFusion UDF Library - arrayFindSubString
December 16th, 2008
«« Back to ColdFusion Library
Category:
ARRAY
Description:
Searches for a value in an array.
Parameters:
Returns:
(Numeric) The last position at which the value is found. Or zero if it is not found.
Requires:
Sample Use:
Copy to Clipboard
Category:
ARRAY
Description:
Searches for a value in an array.
Parameters:
- array (Array, required)
The array to perform the operation on. - value (String, required)
The substring to find in the array. - start (Numeric, Default: 1)
The start postion of the array to begin peforming the search. - subStart (Numeric, Default: 1)
The start postion of the element of the array to begin searching for the substring. - ignorePos (List, Default: )
A list of postions to ignore when searching the array.
Returns:
(Numeric) The last position at which the value is found. Or zero if it is not found.
Requires:
Sample Use:
Copy to Clipboard
function arrayFindSubString(array,value){
var loop = 0;
var len = arrayLen(array);
var pos = 0;
var start = 1;
var ignorePos = "";
var subStart = 1;
if (arrayLen(arguments) gte 3)start = arguments[3];
if (arrayLen(arguments) gte 4)subStart = arguments[4];
if (arrayLen(arguments) gte 5)ignorePos = arguments[5];
for (loop = start; loop lte len; loop = incrementValue(loop))if (findNoCase(value,array[loop],subStart) and not listFindNoCase(ignorePos,loop))pos = loop;
return pos;
}
// http://www.programmers.org/index.php/coldfusion-udf-library/?ckey=83&function=arrayFindSubString



