Hello,
In the array abc:
abc[0] = "john"
abc[1] = "jack"
abc[2] = "john"
abc[3] = "peter"
Is there an easy way to check for "john" existence before inserting
abc[2]?
If not, any idea how to remove either duplicates? that is abc[0] or
abc[2] in the above array?
Thanks in advance.
Maya 1 1814
Why use an array? Use a hashtable. Then you can look up the value before
you insert it and only insert it if it is not already there.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Maya" <kf****@gmail.c om> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hello,
In the array abc:
abc[0] = "john" abc[1] = "jack" abc[2] = "john" abc[3] = "peter"
Is there an easy way to check for "john" existence before inserting abc[2]?
If not, any idea how to remove either duplicates? that is abc[0] or abc[2] in the above array?
Thanks in advance.
Maya This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michelle |
last post by:
hi,
i have created an array from recordset containing user names
eg. (davidp, davidp, evenf, patricka, rebeccah)
which i have sorted in alphabetical order, but i need to
identify duplicates in this array and the number of times it has
been duplicated.
can someone help?
|
by: Dan |
last post by:
hello,
I would to know if it is possible to delete an instance in an array, The
following does not allow me to do a delete.
I am trying to find and delete the duplicate in an array, thanks
for ( j =0; j<MAX ; j++)
{
for ( i =0; i<MAX ; i++)
|
by: cdg |
last post by:
Could anyone tell me how to write a loop for an array, that would have to
check each iteration for duplications of previous entered values. So, the
exact number of loops is not known, but the total number of array elments is
known.
Example: array size - array
(some type of loop statement)
{
array "equal to" or "not equal to" a variable. If not a duplication,
|
by: ak |
last post by:
Is it possible to find repeated(duplicate) element in an array in
single loop ?
AK
|
by: Mokita |
last post by:
Hello,
I am working with Taverna to build a workflow. Taverna has a beanshell where I can program in java. I am having some problems in writing a script, where I want to eliminate the duplicates in an array (String).
for (int k=0; k<myLength; k++){
boolean isthere=false;
for (int l=0; l<sizeres; l++){
if (res.equals(my)){
| |
by: powerej |
last post by:
im having trouble printing an array with duplicate characters, i can enter and print with single characters but when i try and enter and print duplicate ones it puts blanks in my output for a sorted array.
// Imported Packages/Classes
import javax.swing.*;
public class Program6 {
// Add your class methods up here to make the main given to you work correctly!
|
by: fluk |
last post by:
Hi Guys, I hope someone can help me with this, because i'm getting
crazy to find a good way to do that!
This is what I got by querying a db.
$arr1 = array("site", "description", "area1" , "activity1");
$arr2 = array("site", "description", "area1" , "activity2");
$arr3 = array("site", "description", "area2" , "activity2");
$arr4 = array("site1", "description1", "area3" , "activity2");
|
by: chemlight |
last post by:
I'm trying to figure out how to order an array based on the number of duplicates, and then remove all duplicates.
This is my code right now:
foreach($acID as $searchterms){
$results = mysql_query(SELECT * FROM table
WHERE field LIKE '%$searchterms%')
while($row = mysql_fetch_array($results)){
|
by: kylie991 |
last post by:
Hi I am stuck on checking if a 2D array has duplicates.
I have to write a function to check if a column has duplicates and then another function to check if the rows have duplicates from a file.
How would I go about this... I have the array reading a file correctly is it just the check for duplicates that I am stuck on... :)
|
by: Thekid |
last post by:
I'm trying to figure out a way to find if there are duplicates in an array. My idea was to take the array as 'a' and make a second array as 'b' and remove the duplicates from 'b' using 'set' and then compare a to b. If they're different then it will print out 'duplicates found'. The problem is that even after trying different arrays, some with duplicates some without, that 'b' rearranges the numbers. Here's an example:
a='1934, 2311,...
|
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,...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |