Solved

need to find  item from list

Posted on 2013-01-23
5
189 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 15

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 15

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 15

Author Closing Comment

by:Gurpreet Singh Randhawa
ID: 38809771
Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now