473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

list to search two ways

Hi,

I need to create a list a litle bit like this:

1 = q
2 = t
3 = z
4 = u
.....

But I need to have it in such a way that I can find easily the letter for a
given number, but also find easily the number for a given letter.

Is there a structure liek this in VB.NET? Or should I make it myself with a
DataView and a filter?

Thanks,

Pieter
Jul 21 '05 #1
3 1111
Hi Pieter,

Well, there might be classes that are better suitable, but you could
easily do that using a char array. You would need a simple search to
obtain the number for a given character though.

--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2
The problem is too trivial to make much sense.

What are you not telling us?

(note: for an indexed search, you can use a simple lookup array to mirror
the character array, in inverse.
For example, if MyArray(MyIndex) == MyChar

then you would have another array

int MyNewIndex = (int) MyChar;
MyMirrorArray(MyNewIndex) == MyIndex

Does this make sense to you?
--- Nick

"DraguVaso" <pi**********@hotmail.com> wrote in message
news:eR*************@tk2msftngp13.phx.gbl...
Hi,

I need to create a list a litle bit like this:

1 = q
2 = t
3 = z
4 = u
....

But I need to have it in such a way that I can find easily the letter for a given number, but also find easily the number for a given letter.

Is there a structure liek this in VB.NET? Or should I make it myself with a DataView and a filter?

Thanks,

Pieter

Jul 21 '05 #3
Thanks both for the answers.
Although I found a solution like this:

I used the SortedList:

With the SortedList.ContainsKey(number) and the SortedList.Item(number) I
could get the corresponding letter...
With the SortedList.containsValue(letter) and the
SortedList.GetKey(SortedList.IndexOfValue(letter)) I could get the number...

Pieter

"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message
news:9TK9d.227584$3l3.20284@attbi_s03...
The problem is too trivial to make much sense.

What are you not telling us?

(note: for an indexed search, you can use a simple lookup array to mirror
the character array, in inverse.
For example, if MyArray(MyIndex) == MyChar

then you would have another array

int MyNewIndex = (int) MyChar;
MyMirrorArray(MyNewIndex) == MyIndex

Does this make sense to you?
--- Nick

"DraguVaso" <pi**********@hotmail.com> wrote in message
news:eR*************@tk2msftngp13.phx.gbl...
Hi,

I need to create a list a litle bit like this:

1 = q
2 = t
3 = z
4 = u
....

But I need to have it in such a way that I can find easily the letter
for a
given number, but also find easily the number for a given letter.

Is there a structure liek this in VB.NET? Or should I make it myself
with a
DataView and a filter?

Thanks,

Pieter


Jul 21 '05 #4

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

Similar topics

5
by: Darryl B | last post by:
I can not get anywhere on this project I'm tryin to do. I'm not expecting any major help with this but any would be appreciated. The assignment is attached. The problem I'm having is trying to set...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
2
by: George | last post by:
Using VS.NET 2002\Web Form\VB I have a dropdown list that will contain letters of the alphabet. At startup, it has only the letter A in the list. I add letters to the items list, as needed....
8
by: Rajesh | last post by:
Question :An element in a sorted list can be found in O(log n) time via binary search. But suppose I rotate the sorted list at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might...
1
by: rajesh_krec | last post by:
Question :An element in a sorted list can be found in O(log n) time via binary search. But suppose I rotate the sorted list at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5...
10
by: free2cric | last post by:
Hi, I have a single link list which is sorted. structure of which is like typedef struct mylist { int num; struct mylist *next;
4
by: bruce | last post by:
hi... i'm playing with a test sample. i have somethhing like: dog = mysql_get(.....)
6
by: Henrik Goldman | last post by:
Hello, I have a dataset which consist of a string username and string hostname as a key and then an integer representing a count as the matching "second" value in a pair. So far I've used...
8
by: Mike Copeland | last post by:
I am trying to learn/use the STL <listto implement a small application. I didn't get very far before I got a compile error that befuddles me. Here's the code: struct GENCHECK ...
10
by: yfredmann | last post by:
Hi dear friends, This problem might be so popular to some of you, but I couldn't be able to do it myself. The problem: How to delete a node from a single linked list using only one pointer? ...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
jinu1996
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...
0
tracyyun
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...
0
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,...
0
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...

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.