473,811 Members | 2,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding the non-matching values collection/array

Hi all,

Ok, lets say I have the following,

Request.Form collection which produces this (as the element names)

a
b
c
d
e
f

And I also have an array containg this

a
b
c

What I want to do is loop through both and response.write to the screen only
the items that are not the same, so in this case I would see

d
e
f

displayed on the screen, I've tried a couple of things but its not working,
has anyone got any suggestions...

Cheers

Robb
Jul 19 '05 #1
4 3767
anyone got any ideas with this? I really could do with some help please :o)

Robb
Jul 19 '05 #2
for i = 0 to ubound(ARR2)
found = "false"
for j = 0 to ubound(ARR1)
if (ARR2(i) = ARR1(j)) then
found = "true"
exit for
end if
next
if found ="false" then
strOutput=strOu tput & ARR2(i) & ","
ARR2temp = ARR2(i)
end if
next
Jul 19 '05 #3
Robb Meade wrote on 29 jun 2003 in
microsoft.publi c.inetserver.as p.general:
for i = 0 to ubound(ARR2)
found = "false"
for j = 0 to ubound(ARR1)
if (ARR2(i) = ARR1(j)) then
found = "true"
exit for
end if
next
if found ="false" then
strOutput=strOu tput & ARR2(i) & ","
ARR2temp = ARR2(i)
end if
next

Where is ARR2temp used for ?
You need to initialise strOutput
Better use a boolean for "found"

Let me try:

strOutput=""
for i = 0 to ubound(ARR2)
found = false
for j = 0 to ubound(ARR1)
if ARR2(i) = ARR1(j) then
found = true
exit for
end if
next
if not found then
strOutput=strOu tput & ARR2(i) & "<br>"
end if
next
response.write strOutput

=============== ==============

Even so, if ARR2 has duplicates not in ARR1, they will be written
And if ARR1 has entries not in ARR2 they will not be written

Perhaps it is better to
1 delete all double entries inside each array
2 put all values in one array arr3 and
3 output all non-double entries ?

This is step 3:

for i=0 to ubound(arr3)
for j=0 to ubound(arr3)
found=false
if arr3(i)=arr3(j) and i<>j then
found=true
exit for
end if
next
if not found then
response.write arr3(i) & "<br>"
end if
next
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #4
Evertjan. wrote on 29 jun 2003 in microsoft.publi c.inetserver.as p.general:
for i=0 to ubound(arr3)
for j=0 to ubound(arr3)
found=false
if arr3(i)=arr3(j) and i<>j then
.....


damn, still not right, should be:

for i=0 to ubound(arr3)
found=false
for j=0 to ubound(arr3)
if arr3(i)=arr3(j) and i<>j then
found=true
exit for
end if
next
if not found then
response.write arr3(i) & "<br>"
end if
next
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5639
by: m sergei | last post by:
I am not asking for code but wanted help with understanding the algorithm to permute all characters of a string. say string is "ABCD" I want to know the algorithm for finding all permutations of the given string, without recursion and with recursion.
2
3146
by: Pawe³ | last post by:
Hello! I'm looking for efficient code or site where I can find code for finding one string in another string. String which I search should have "wild" characters like '?' for any one char and '*' for any string of characters. I'm looking for way to effective getting string from text file and then searching it like I write above. Thanks in advance for any helps, notices or sites
32
5127
by: someone else | last post by:
hi all I'm a newbie to this group. my apologies if I break any rules. I've wrote a simple program to find the first 1,000,000 primes, and to find all primes within any range (up to 200 * 10^12) it's pretty efficient, it took 15 minutes to compute the first 1,000,000 primes.
9
10331
by: minil | last post by:
Hi any c function in linux to return size of directory (Including its files & subdirectories & its files).. I can stat() only files . not for directories. please reply me soon Thanks in advance
2
1925
by: marc.gibian | last post by:
I am modifying an existing ASP.NET application to make it SSL compatible. I have already searched the codebase and eliminated all hardcoded "http" instances, replacing them with a method call that returns the appropriate ("http" or "https") value in a given context. I have also modified all iframe instances to ensure they always have a valid src. But, when I run the application, I still encounter the following Security dialog in IE: ...
4
6362
by: spivee | last post by:
I'm having an odd type of issue. I want to be able to pass an element name in my javascript event and find the location of the element, be it a div, span, img whatever, specifically the top and left attributes. I have defined my element like so... ### .css file... #mydiv { position:absolute;
4
8494
by: sathyashrayan | last post by:
(This is not a home work question) Dear group, I want a program to find one number between a set of natural number.A program to guess a number in between a Natural number set.This should be a simple task but my mind suddenly got stuck. I am trying to implement a square root function as a practice. I am able to code for the perfect square
12
9146
by: bg_ie | last post by:
Hi, I'm updating my program to Python 2.5, but I keep running into encoding problems. I have no ecodings defined at the start of any of my scripts. What I'd like to do is scan a directory and list all the files in it that contain a non ascii character. How would I go about doing this? Thanks,
0
5553
NeoPa
by: NeoPa | last post by:
Introduction: This seems like a very straightforward topic. Why would anyone need help finding MS Access Help related to this topic? I can't really answer that except to say that I know from experience that many do. I myself spent a great deal of time under the impression that it was non-existent. How to Find it: Different versions of MS Access structure their help systems differently, so don't expect it to be in the same place for each...
7
2763
by: Nick | last post by:
Hi there, I have a website that functions fine locally, but when published to the server it develops a bottleneck during loading some of the pages. Basically what happens is the page loads to about 25% then it freezes for anything from 10 - 40 seconds, before suddenly loading the rest of the page. Of course I understand that this could be down to some code on the page locking the thread or suchlike, but I would like to be able to be...
0
9724
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.