Solved

need to find  item from list

Posted on 2013-01-23
5
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

688 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