Link to home
Start Free TrialLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

need to find item from list

Hi, I need to find 69 from 65 - 72 how can i do, i tried listfind, listcontains, none working
Avatar of Tomarse111
Tomarse111
Flag of United Kingdom of Great Britain and Northern Ireland image

So your string would be:

65,66,67,68,69,70,71,72 ??

and you want to check if 69 is in it?

What version of CF are you using?

Bit more information would be helpful

Tom
Avatar of Coast Line

ASKER

i used this function

function listFindMissing(list) {
  var delim="-"; // list delimiter
  var arrToSearch="";
  var i=0;
  var j=0;    
  var returnList="";
  if(arrayLen(arguments) GTE 2) delim = arguments[2];
  arrToSearch=listToArray(list,delim);
  for(i=ArrayMin(arrToSearch);i LTE arrayMax(arrToSearch);i=i+1)
    for(j=1;j LTE arrayLen(arrToSearch);j=j+1)
      if(arrToSearch[j] EQ i)  break;
      else
        if (j EQ arrayLen(arrToSearch))
          returnList = listAppend(returnList,i,delim);
  return returnList;
}

but it is skipping the first and the last letter say

the values are 65-72

it shows me 66,67,68,69,70,71

i need the start and the end too of this
i am on cf 10
ASKER CERTIFIED SOLUTION
Avatar of Tomarse111
Tomarse111
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks