Solved

need to find  item from list

Posted on 2013-01-23
5
193 Views
Last Modified: 2013-01-23
Hi, I need to find 69 from 65 - 72 how can i do, i tried listfind, listcontains, none working
0
Comment
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:Tomarse111
ID: 38809634
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
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 38809663
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
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 38809665
i am on cf 10
0
 
LVL 15

Accepted Solution

by:
Tomarse111 earned 500 total points
ID: 38809737
Removing your check fixes it but dont fully appreciate the implications, if any of doing that:

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)	
			returnList = listAppend(returnList, i, delim);
					
		return returnList;
	}

Open in new window

0
 
LVL 16

Author Closing Comment

by:Gurpreet Singh Randhawa
ID: 38809771
Thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CFdocumnet font issue 5 47
Coldfusion Table display that allows inline edit 3 60
Passing value to a stored procedure 8 110
Coldfusion UNIX/EPOCH Time Conversion - Time Zone? 11 83
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question