I have two comma delimted strings that I need to compare individual values
between the two. I assume the solution is likely to put them into an array?
If so, do I need to loop through one, comparing the other, or is there some
sort of compare function already in .net?
For instance, I have these strings:
str1: ,3,6,12,17,
str2: ,7,8,12,
I need to check to see if any of the values in str1 exists in str2.
Off the top of my yead, I could split str2 into an array, then loop through
the values in the array using the instr function to see if they exist in
str1.
-Darrel 2 2037
there are a lot of ways to do this. You could split on array loop through
it and look for a non-negative IndexOf of the value within the other string.
you could split both and loop through both
you could split them and load them in arraylists and use Contains (which
merely loops)
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"darrel" <no*****@nowhere.com> wrote in message
news:eY**************@TK2MSFTNGP09.phx.gbl... I have two comma delimted strings that I need to compare individual values between the two. I assume the solution is likely to put them into an array? If so, do I need to loop through one, comparing the other, or is there some sort of compare function already in .net?
For instance, I have these strings:
str1: ,3,6,12,17,
str2: ,7,8,12,
I need to check to see if any of the values in str1 exists in str2.
Off the top of my yead, I could split str2 into an array, then loop through the values in the array using the instr function to see if they exist in str1.
-Darrel there are a lot of ways to do this. You could split on array loop through it and look for a non-negative IndexOf of the value within the other string.
you could split both and loop through both
you could split them and load them in arraylists and use Contains (which merely loops)
Looping it is!
Just realized that it's not really that big of an issue. Split one of the
two, loop through the other comparing.
-Darrel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jorgen Gustafsson |
last post by:
Hi,
im trying to write a small progam to compare data in 2 textfiles.
I want to search for values that doesnt exist in File2.
The result should be "3" in the example below but Im not
able to do...
|
by: Raistlin |
last post by:
Hey, for c++ does any body have a way to compare two arrays? Say one
has the numbers 1-5000, the other has *most* of the numbers from
1-5000, is there a way to display the numbers that are in the...
|
by: Iain |
last post by:
Hi
Hopefully I am missing something really simple with this question, but
here goes.
I have two Bitarrays that I would like to compare. At the moment, I am
XORing one with the other and...
|
by: Elijah Bailey |
last post by:
I have two char arrays of size k.
I want to know which one is bigger (exactly like for instance
I compare two ints/longs/etc.).
What is the fastest way to do this? k <= 10 usually for my...
|
by: Ole Nielsby |
last post by:
How does the GetHashCode() of an array object behave?
Does it combine the GetHashCode() of its elements, or does
it create a sync block for the object?
I want to use readonly arrays as...
|
by: psmahesh |
last post by:
Hi folks,
I am comparing two arrays and removing matches from the second array
from the first array.
Can someone take a look at this code below and mention if this is okay
and perhaps if there...
|
by: Adrienne Boswell |
last post by:
I have a form which I am letting the user enter more than one event at
a time. I need to check whether one date is less than another. If the
display to date is earlier than the event date, then...
|
by: chiefychf |
last post by:
I'm working on a school project and I am having a few issues... The program calls for three arrays a,b,c that have to be sorted, then compared to even or odd and stored in arrays d & e, then merge...
|
by: =?Utf-8?B?Sm9zaFA=?= |
last post by:
Hi All, I am attempting to compare values in two arraylists to make sure all
the values are the same. I am running into trouble with my code if both
arraylists compare okay up until a point and I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |